mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-02-10 21:44:53 +00:00
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
|
import Group from "discourse/models/group";
|
|
|
|
export default Discourse.Route.extend({
|
|
model(params) {
|
|
const id = params["plan-id"];
|
|
const product = this.modelFor(
|
|
"adminPlugins.discourse-subscriptions.products.show"
|
|
).product;
|
|
let plan;
|
|
|
|
if (id === "new") {
|
|
plan = AdminPlan.create({
|
|
active: true,
|
|
isNew: true,
|
|
currency: Discourse.SiteSettings.discourse_patrons_currency,
|
|
product: product.get("id")
|
|
});
|
|
} else {
|
|
plan = AdminPlan.find(id);
|
|
}
|
|
|
|
const groups = Group.findAll({ ignore_automatic: true });
|
|
|
|
return Ember.RSVP.hash({ plan, product, groups });
|
|
},
|
|
|
|
renderTemplate() {
|
|
this.render("adminPlugins.discourse-subscriptions.products.show.plans.show", {
|
|
into: "adminPlugins.discourse-subscriptions.products",
|
|
outlet: "main",
|
|
controller: "adminPlugins.discourse-subscriptions.products.show.plans.show"
|
|
});
|
|
}
|
|
});
|