product controller
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
const Product = Discourse.Model.extend({});
|
||||
|
||||
Product.reopenClass({
|
||||
findAll() {
|
||||
return ajax("/patrons/products", { method: "get" }).then(result =>
|
||||
result.map(product => Product.create(product))
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default Product;
|
||||
@@ -1,6 +1,8 @@
|
||||
export default function() {
|
||||
this.route("patrons", function() {
|
||||
this.route("subscribe");
|
||||
this.route("subscribe", function() {
|
||||
this.route("product", { path: ":product_id" })
|
||||
});
|
||||
this.route("show", { path: ":pid" });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,10 +10,9 @@ export default Discourse.Route.extend({
|
||||
return `$${toCurrency(plan.amount)} ${plan.currency.toUpperCase()} / ${plan.interval}`;
|
||||
};
|
||||
|
||||
const group = Group.find();
|
||||
const plans = Plan.findAll().then(results => results.map(p => planSelectText(p)));
|
||||
const subscription = Subscription.create();
|
||||
|
||||
return Ember.RSVP.hash({ group, plans, subscription });
|
||||
return Ember.RSVP.hash({ plans, subscription });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user