diff --git a/assets/javascripts/discourse/models/plan.js.es6 b/assets/javascripts/discourse/models/plan.js.es6 index de04a99..952a540 100644 --- a/assets/javascripts/discourse/models/plan.js.es6 +++ b/assets/javascripts/discourse/models/plan.js.es6 @@ -2,10 +2,16 @@ import computed from "ember-addons/ember-computed-decorators"; import { ajax } from "discourse/lib/ajax"; const Plan = Discourse.Model.extend({ - @computed("amount") - amountDollars(amount) { - return parseFloat(amount / 100).toFixed(2); - }, + amountDollars: Ember.computed("amount", { + get() { + return parseFloat(this.get("amount") / 100).toFixed(2); + }, + set(key, value) { + const decimal = parseFloat(value) * 100; + this.set("amount", decimal); + return value; + } + }), @computed("amountDollars", "currency", "interval") subscriptionRate(amountDollars, currency, interval) { diff --git a/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-products-show-plans-show.hbs b/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-products-show-plans-show.hbs index 371404b..c3f583c 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-products-show-plans-show.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-discourse-patrons-products-show-plans-show.hbs @@ -22,7 +22,7 @@

- {{input type="text" name="name" value=model.plan.amount disabled=planFieldDisabled}} + {{input type="text" name="name" value=model.plan.amountDollars disabled=planFieldDisabled}}