diff --git a/app/controllers/admin/plans_controller.rb b/app/controllers/admin/plans_controller.rb index 0f56505..c85f557 100644 --- a/app/controllers/admin/plans_controller.rb +++ b/app/controllers/admin/plans_controller.rb @@ -24,5 +24,10 @@ module DiscoursePatrons render json: plan end + + def destroy + plan = ::Stripe::Plan.delete(params[:id]) + render json: plan + end end end 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 9fcc419..bb6314a 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,5 +1,9 @@ +import { ajax } from "discourse/lib/ajax"; + export default Ember.Controller.extend({ actions: { - deletePlan(plan) {} + 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 0381917..f0fae54 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 @@ -15,7 +15,7 @@