url for edit

This commit is contained in:
Rimian Perkins 2019-09-27 09:42:32 +10:00
parent 9d982307d5
commit bee940e672
3 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,10 @@ export default Ember.Controller.extend({
actions: { actions: {
deletePlan(id) { deletePlan(id) {
return ajax(`/patrons/admin/plans/${id}`, { method: "delete" }); return ajax(`/patrons/admin/plans/${id}`, { method: "delete" });
},
editPlan(id) {
return DiscourseURL.redirectTo(`/admin/plugins/discourse-patrons/plans/${id}`);
} }
} }
}); });

View File

@ -1,7 +1,7 @@
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({ export default Discourse.Route.extend({
model(params) { model() {
return ajax("/patrons/admin/subscriptions", { method: "get" }); return ajax("/patrons/admin/subscriptions", { method: "get" });
} }
}); });

View File

@ -15,6 +15,7 @@
<td>{{plan.interval}}</td> <td>{{plan.interval}}</td>
<td>{{plan.amount}}</td> <td>{{plan.amount}}</td>
<td> <td>
{{d-button action=(action "editPlan" plan.id) icon="far-edit" class="btn no-text btn-icon"}}
{{d-button action=(action "deletePlan" plan.id) icon="trash-alt" class="btn-danger btn no-text btn-icon"}} {{d-button action=(action "deletePlan" plan.id) icon="trash-alt" class="btn-danger btn no-text btn-icon"}}
</td> </td>
</tr> </tr>