From 9d982307d5176c72a55f1269861b5736a1469fd6 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Wed, 25 Sep 2019 13:39:23 +1000 Subject: [PATCH] filter by deleted --- .../admin-plugins-discourse-patrons-plans-index.js.es6 | 6 ++++++ .../admin/plugins-discourse-patrons-plans-index.hbs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/controllers/admin-plugins-discourse-patrons-plans-index.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-discourse-patrons-plans-index.js.es6 index bb6314a..097284c 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-discourse-patrons-plans-index.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-plugins-discourse-patrons-plans-index.js.es6 @@ -1,6 +1,12 @@ import { ajax } from "discourse/lib/ajax"; +import computed from "ember-addons/ember-computed-decorators"; export default Ember.Controller.extend({ + @computed("model.plans") + plans(plans) { + return plans.filter(plan => !plan.deleted); + }, + actions: { deletePlan(id) { return ajax(`/patrons/admin/plans/${id}`, { method: "delete" }); diff --git a/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-plans-index.hbs b/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-plans-index.hbs index f0fae54..be1ddd0 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-plans-index.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-plans-index.hbs @@ -8,7 +8,7 @@ {{i18n 'discourse_patrons.admin.plans.plan.interval'}} {{i18n 'discourse_patrons.admin.plans.plan.amount'}} - {{#each model.plans as |plan|}} + {{#each plans as |plan|}} {{plan.id}} {{plan.nickname}}