mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-07-13 17:43:26 +00:00
format the select dropdowns for plans
This commit is contained in:
parent
21b27f169a
commit
5f71def8a4
@ -4,8 +4,14 @@ import Subscription from "discourse/plugins/discourse-patrons/discourse/models/s
|
|||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
model() {
|
model() {
|
||||||
|
const toCurrency = (cents) => parseFloat(cents/100).toFixed(2);
|
||||||
|
|
||||||
|
const planSelectText = (plan) => {
|
||||||
|
return `$${toCurrency(plan.amount)} ${plan.currency.toUpperCase()} / ${plan.interval}`;
|
||||||
|
};
|
||||||
|
|
||||||
const group = Group.find();
|
const group = Group.find();
|
||||||
const plans = Plan.findAll().then(results => results.map(p => ({ id: p.id, name: p.nickname })));
|
const plans = Plan.findAll().then(results => results.map(p => planSelectText(p)));
|
||||||
const subscription = Subscription.create();
|
const subscription = Subscription.create();
|
||||||
|
|
||||||
return Ember.RSVP.hash({ group, plans, subscription });
|
return Ember.RSVP.hash({ group, plans, subscription });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user