list plans in admin
This commit is contained in:
parent
4e615908f4
commit
16513e29ea
|
@ -9,7 +9,7 @@ module DiscoursePatrons
|
|||
|
||||
def index
|
||||
plans = ::Stripe::Plan.list
|
||||
render json: plans.data
|
||||
render_json_dump plans.data
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -32,7 +32,7 @@ module DiscoursePatrons
|
|||
|
||||
def destroy
|
||||
plan = ::Stripe::Plan.delete(params[:id])
|
||||
render json: plan
|
||||
render_json_dump plan
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -9,7 +9,7 @@ module DiscoursePatrons
|
|||
|
||||
def index
|
||||
subscriptions = ::Stripe::Subscription.list
|
||||
subscriptions.to_json
|
||||
render_json_dump subscriptions
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ export default Ember.Controller.extend({
|
|||
return ajax("/patrons/customers", { method: "post", data: customerData }).then(
|
||||
customer => {
|
||||
// TODO move default plan into settings
|
||||
if(this.get('model.selectedPlan') == undefined) {
|
||||
if(this.get('model.selectedPlan') === undefined) {
|
||||
this.set('model.selectedPlan', this.get('model.plans.firstObject'));
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ const AdminPlan = Discourse.Model.extend({
|
|||
AdminPlan.reopenClass({
|
||||
find() {
|
||||
return ajax("/patrons/admin/plans", { method: "get" }).then(result =>
|
||||
result.plans.map(plan => AdminPlan.create(plan))
|
||||
result.map(plan => AdminPlan.create(plan))
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
const AdminSubscription = Discourse.Model.extend({});
|
||||
|
||||
AdminSubscription.reopenClass({
|
||||
find() {
|
||||
return ajax("/patrons/admin/subscriptions", { method: "get" }).then(result =>
|
||||
result.data.map(subscription => AdminSubscription.create(subscription))
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default AdminSubscription;
|
|
@ -1,7 +1,7 @@
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
import AdminSubscription from "discourse/plugins/discourse-patrons/discourse/models/admin-subscription";
|
||||
|
||||
export default Discourse.Route.extend({
|
||||
model() {
|
||||
return ajax("/patrons/admin/subscriptions", { method: "get" });
|
||||
return AdminSubscription.find();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
|
||||
<h3>{{i18n 'discourse_patrons.admin.subscriptions.title'}}</h3>
|
||||
|
||||
<table class="table discourse-patrons-admin">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
{{#each model as |subscription|}}
|
||||
<tr>
|
||||
<td>{{subscription.id}}</td>
|
||||
<td>
|
||||
{{#link-to 'adminPlugins.discourse-patrons.plans.show' subscription.plan.id}}
|
||||
{{subscription.plan.id}}
|
||||
{{/link-to}}
|
||||
</td>
|
||||
<td>{{subscription.status}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue