cannot subscribe to a product twice
This commit is contained in:
parent
1429bf116f
commit
e5753095d8
|
@ -6,6 +6,7 @@ export default Discourse.Route.extend({
|
||||||
model(params) {
|
model(params) {
|
||||||
const product_id = params["subscription-id"];
|
const product_id = params["subscription-id"];
|
||||||
const product = Product.find(product_id);
|
const product = Product.find(product_id);
|
||||||
|
|
||||||
const subscription = Subscription.create();
|
const subscription = Subscription.create();
|
||||||
const plans = Plan.findAll({ product_id: product_id }).then(results =>
|
const plans = Plan.findAll({ product_id: product_id }).then(results =>
|
||||||
results.map(p => ({ id: p.id, name: p.subscriptionRate }))
|
results.map(p => ({ id: p.id, name: p.subscriptionRate }))
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
{{#if currentUser}}
|
{{#if currentUser}}
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{{#link-to "patrons.subscribe.show" product.id class="btn btn-primary"}}
|
{{#link-to "patrons.subscribe.show" product.id disabled=product.subscribed class="btn btn-primary"}}
|
||||||
{{i18n 'discourse_patrons.subscribe.title'}}
|
{{i18n 'discourse_patrons.subscribe.title'}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section-column">
|
<div class="section-column">
|
||||||
|
{{#unless model.product.subscribed}}
|
||||||
|
|
||||||
{{combo-box valueAttribute="id" content=model.plans value=model.product.plan}}
|
{{combo-box valueAttribute="id" content=model.plans value=model.product.plan}}
|
||||||
|
|
||||||
{{#d-button
|
{{#d-button
|
||||||
|
@ -29,5 +31,7 @@
|
||||||
{{#if loading}}
|
{{#if loading}}
|
||||||
{{loading-spinner}}
|
{{loading-spinner}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue