diff options
| -rw-r--r-- | public/assets/javascripts/ui/site/EditSubscriptionModal.js | 40 | ||||
| -rw-r--r-- | views/partials/edit-subscription.ejs | 28 |
2 files changed, 52 insertions, 16 deletions
diff --git a/public/assets/javascripts/ui/site/EditSubscriptionModal.js b/public/assets/javascripts/ui/site/EditSubscriptionModal.js index 1b3b859..342e8be 100644 --- a/public/assets/javascripts/ui/site/EditSubscriptionModal.js +++ b/public/assets/javascripts/ui/site/EditSubscriptionModal.js @@ -7,15 +7,51 @@ var EditSubscriptionModal = ModalFormView.extend({ fixedClose: true, events: { - "click [data-role='changePasswordToggle']": 'togglePasswordFields' + "click [data-role='']": 'togglePasswordFields' + }, + + initialize: function(){ + this.$freePlan = this.$("#free_plan") + this.$paidPlan = this.$("#paid_plan") + this.$proLayoutRow = this.$("#proLayoutRow") + + this.$billingInterval = this.$("[data-role=billingInterval]") + + this.$planType = this.$("[data-role=planType]") + this.$planName = this.$("[data-role=planName]") + this.$planCost = this.$("[data-role=planCost]") + + this.$basicLayoutCost = this.$("[data-role=basicLayoutCost]") + this.$basicLayoutQuantity = this.$("[data-role=basicLayoutQuantity]") + + this.$proLayoutCost = this.$("[data-role=proLayoutCost]") + this.$proLayoutQuantity = this.$("[data-role=proLayoutQuantity]") + + this.$upgradeSubscription = this.$("[data-role=upgradeSubscription]") + this.$cancelSubscription = this.$("[data-role=cancelSubscription]") }, load: function(){ this.reset() $.get("/api/subscription", function(data){ - + if (data.error) { + this.$freePlan.show() + this.$paidPlan.hide() + this.show() + return + } + this.$freePlan.show() + this.$paidPlan.hide() + + var plan = data.plans[ data.subscription.plan_name ] + this.show() + + // layouts }.bind(this)) }, + + updateTotals: function(){ + }, }) diff --git a/views/partials/edit-subscription.ejs b/views/partials/edit-subscription.ejs index adc3f71..f49d791 100644 --- a/views/partials/edit-subscription.ejs +++ b/views/partials/edit-subscription.ejs @@ -13,37 +13,37 @@ <p> <a href="/about/brochure">View the Plans</a> </div> - <div id="free_plan"> - Your current plan level is <span id="user_plan_type"></span> + <div id="paid_plan"> + Your current plan level is <span data-role="planName"></span> <table> <tr> - <td>Basic plan</td> + <td><span data-role="planType"></span> plan</td> <td></td> - <td>@ $<span></span>/<span></span></td> + <td>@ $<span data-role="planCost"></span>/<span data-role="billingInterval"></span></td> </tr> <tr> - <td>Additional basic layouts</td> + <td>Additional Basic layouts</td> <td></td> - <td>@ $<span></span>/<span></span></td> + <td>@ $<span data-role="basicLayoutCost"></span>/<span data-role="billingInterval"></span></td> <td>Buy more</td> </tr> - <tr> - <td>Additional PRO layouts</td> - <td></td> - <td>$<span></span>/<span></span></td> + <tr id="proLayoutRow"> + <td>Additional Pro layouts</td> + <td><span data-role="basicLayoutQuantity"></span></td> + <td>@ $<span data-role="basicLayoutCost"></span>/<span data-role="billingInterval"></span></td> <td>Buy more</td> </tr> <tr> <td>Total</td> - <td></td> - <td>$<span></span>/<span></span></td> + <td><span data-role="proLayoutQuantity"></span></td> + <td>$<span data-role="proLayoutCost"></span>/<span data-role="billingInterval"></span></td> </tr> </table> - <button>Upgrade your subscription</button> + <button data-role="upgradeSubscription">Upgrade your subscription</button> - <button>Cancel your subscription</button> + <button data-role="cancelSubscription">Cancel your subscription</button> </li> </ul> </form> |
