add nested route

This commit is contained in:
Rimian Perkins 2019-10-21 09:47:18 +11:00
parent a914d4ee59
commit 0d4cd5b1e5
4 changed files with 15 additions and 19 deletions

View File

@ -1,11 +1 @@
import DiscourseURL from "discourse/lib/url";
export default Ember.Controller.extend({
actions: {
editProduct(id) {
return DiscourseURL.redirectTo(
`/admin/plugins/discourse-patrons/products/${id}`
);
}
}
});
export default Ember.Controller.extend({});

View File

@ -4,12 +4,20 @@ export default {
map() {
this.route("discourse-patrons", function() {
this.route("dashboard");
this.route("products", function() {
this.route("plans", { path: "/:product-id/plans" }, function() {
this.route("show", { path: "/:plan-id" });
});
this.route("show", { path: "/:product-id" });
});
this.route("plans", function() {
this.route("show", { path: "/:plan-id" });
});
// this.route("products", function() {
// this.route("show", { path: "/:product-id" });
// });
// this.route("plans", function() {
// this.route("show", { path: "/:plan-id" });
// });
this.route("subscriptions");
});
}

View File

@ -14,10 +14,9 @@
<td>{{product.metadata.group_name}}</td>
<td>{{product.active}}</td>
<td class="td-right">
{{d-button
action=(action "editProduct" product.id)
icon="far-edit"
class="btn no-text btn-icon"}}
{{#link-to "adminPlugins.discourse-patrons.products.show" product.id class="btn no-text btn-icon"}}
{{d-icon "far-edit"}}
{{/link-to}}
{{d-button
action=(route-action "destroyProduct")
actionParam=product

View File

@ -4,7 +4,6 @@
<ul class="nav nav-pills">
{{nav-item route='adminPlugins.discourse-patrons.dashboard' label='discourse_patrons.admin.dashboard.title'}}
{{nav-item route='adminPlugins.discourse-patrons.products' label='discourse_patrons.admin.products.title'}}
{{nav-item route='adminPlugins.discourse-patrons.plans' label='discourse_patrons.admin.plans.title'}}
{{nav-item route='adminPlugins.discourse-patrons.subscriptions' label='discourse_patrons.admin.subscriptions.title'}}
</ul>