From 437ea768f2cca49922a212afce7412f61e1894c0 Mon Sep 17 00:00:00 2001 From: israel de la hoz Date: Thu, 7 May 2015 23:01:32 -0500 Subject: [PATCH 1/8] settings page with current plan --- app/controllers/team/settings.js | 7 +++++++ app/models/plan.js | 7 +++++++ app/models/team.js | 4 +++- app/router.js | 3 ++- app/routes/team/settings.js | 8 ++++++++ app/templates/account-nav.hbs | 2 +- app/templates/team-nav.hbs | 3 ++- app/templates/team/settings.hbs | 15 +++++++++++++++ package.json | 3 ++- 9 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 app/controllers/team/settings.js create mode 100644 app/models/plan.js create mode 100644 app/routes/team/settings.js create mode 100644 app/templates/team/settings.hbs diff --git a/app/controllers/team/settings.js b/app/controllers/team/settings.js new file mode 100644 index 0000000..bb20e09 --- /dev/null +++ b/app/controllers/team/settings.js @@ -0,0 +1,7 @@ +import Ember from 'ember'; + +export default Ember.Controller.extend({ + plans: Ember.computed(function(){ + return this.store.find('plan'); + }) +}); diff --git a/app/models/plan.js b/app/models/plan.js new file mode 100644 index 0000000..d1471e0 --- /dev/null +++ b/app/models/plan.js @@ -0,0 +1,7 @@ +import DS from 'ember-data'; + +export default DS.Model.extend({ + slug: DS.attr('string'), + name: DS.attr('string'), + trial_period_days: DS.attr('number') +}); \ No newline at end of file diff --git a/app/models/team.js b/app/models/team.js index 78783ff..7446e4a 100644 --- a/app/models/team.js +++ b/app/models/team.js @@ -2,8 +2,10 @@ import DS from 'ember-data'; export default DS.Model.extend({ name: DS.attr('string'), + planName: DS.attr('string'), + planSlug: DS.attr('string'), subdomain: DS.attr('string'), owner: DS.belongsTo('user', { async: true }), teamMemberships: DS.hasMany('team-membership', { async: true }), members: DS.hasMany('user') -}); +}); \ No newline at end of file diff --git a/app/router.js b/app/router.js index 6f7c93d..a1fd752 100644 --- a/app/router.js +++ b/app/router.js @@ -19,10 +19,11 @@ export default Router.map(function() { this.route('team-members', { path: 'members' }, function() { this.route('index', { path: '/' }); }); + this.route('settings'); }); } else if (shouldMapGeneralRoutes) { this.route('general', { path: '/' }, function() { this.route('create-team'); }); } -}); +}); \ No newline at end of file diff --git a/app/routes/team/settings.js b/app/routes/team/settings.js new file mode 100644 index 0000000..47b6708 --- /dev/null +++ b/app/routes/team/settings.js @@ -0,0 +1,8 @@ +import Ember from 'ember'; +import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin'; + +export default Ember.Route.extend(AuthenticatedRouteMixin, { + model: function() { + return this.store.find('team', 'current'); + } +}); \ No newline at end of file diff --git a/app/templates/account-nav.hbs b/app/templates/account-nav.hbs index ddffae5..08d2a38 100644 --- a/app/templates/account-nav.hbs +++ b/app/templates/account-nav.hbs @@ -12,4 +12,4 @@ {{/if}} - + \ No newline at end of file diff --git a/app/templates/team-nav.hbs b/app/templates/team-nav.hbs index 664c759..55d1aed 100644 --- a/app/templates/team-nav.hbs +++ b/app/templates/team-nav.hbs @@ -2,5 +2,6 @@ - + \ No newline at end of file diff --git a/app/templates/team/settings.hbs b/app/templates/team/settings.hbs new file mode 100644 index 0000000..5e1f1a4 --- /dev/null +++ b/app/templates/team/settings.hbs @@ -0,0 +1,15 @@ +

Setting for {{model.name}}

+

Your team is currently subscribed to the {{model.planName}}

+ +
+ {{#each plan in plans}} + {{radio-button + value=plan.slug + groupValue=model.planSlug + required=true + name="plan"}} + {{plan.name}} + {{/each}} + + +
\ No newline at end of file diff --git a/package.json b/package.json index 7d66a41..7b1ba17 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "ember-cli-uglify": "1.0.1", "ember-data": "1.0.0-beta.16.1", "ember-export-application-global": "^1.0.2", - "ember-json-api": "git://github.com/eneuhauser/ember-json-api.git" + "ember-json-api": "git://github.com/eneuhauser/ember-json-api.git", + "ember-radio-button": "1.0.5" } } From b47279480c25102343cf196c5ba0311ba7f9bddd Mon Sep 17 00:00:00 2001 From: israel de la hoz Date: Fri, 8 May 2015 00:50:03 -0500 Subject: [PATCH 2/8] Add stripe --- app/controllers/team/settings.js | 50 +++++++++++++++++++++++++++++++- app/models/plan.js | 4 ++- app/templates/team/settings.hbs | 20 +++++++++++-- 3 files changed, 70 insertions(+), 4 deletions(-) diff --git a/app/controllers/team/settings.js b/app/controllers/team/settings.js index bb20e09..f43f907 100644 --- a/app/controllers/team/settings.js +++ b/app/controllers/team/settings.js @@ -1,7 +1,55 @@ import Ember from 'ember'; +import UrlInfo from 'teamplaybook-ember/lib/url-info'; +import ajax from 'ic-ajax'; export default Ember.Controller.extend({ + cardToken: null, + plans: Ember.computed(function(){ return this.store.find('plan'); - }) + }), + + actions:{ + changePlan: function(){ + var plans = this.store.all('plan'); + var plan = plans.findBy('slug', this.get('model.planSlug')); + + if(plan.isPaidPlan){ + createStripeToken(requestPlanChange); + }else{ + requestPlanChange(); + } + } + }, + + _buildURL: function(path) { + var apiUrl = this.get('urlInfo.apiUrl'); + return apiUrl + '/' + path; + }, + + requestPlanChange: function(){ + var controller = this; + + ajax({ + type: 'POST', + url: this._buildURL('team/change_plan'), + data: { + plan_slug: this.get('model.planSlug'), + card_token: this.get('cardToken') + } + }).then(function(){ + controller.get('model').reload(); + }); + }, + + createStripeToken: function(callback){ + var controller = this; + var $form = $('#payment-form'); + + stripeCallback = function(status, response){ + controller.set('cardToken', response.id); + callback(); + } + Stripe.card.createToken($form, stripeCallback); + } }); diff --git a/app/models/plan.js b/app/models/plan.js index d1471e0..c3b76a9 100644 --- a/app/models/plan.js +++ b/app/models/plan.js @@ -3,5 +3,7 @@ import DS from 'ember-data'; export default DS.Model.extend({ slug: DS.attr('string'), name: DS.attr('string'), - trial_period_days: DS.attr('number') + trial_period_days: DS.attr('number'), + amount: DS.attr('number'), + isPaidPlan: Ember.computed.gt('amount', 0) }); \ No newline at end of file diff --git a/app/templates/team/settings.hbs b/app/templates/team/settings.hbs index 5e1f1a4..42740dd 100644 --- a/app/templates/team/settings.hbs +++ b/app/templates/team/settings.hbs @@ -1,3 +1,4 @@ +

Setting for {{model.name}}

Your team is currently subscribed to the {{model.planName}}

@@ -10,6 +11,21 @@ name="plan"}} {{plan.name}} {{/each}} + - - \ No newline at end of file +

Add your credit card information

+ +
+ + + + + + + + + + +
+ + \ No newline at end of file From c18ddcae3fcd4cb0099a6cccb0a3dffbaa1c5a42 Mon Sep 17 00:00:00 2001 From: israel de la hoz Date: Fri, 8 May 2015 05:44:02 -0500 Subject: [PATCH 3/8] fix policies --- app/controllers/team/settings.js | 12 +++++++++--- app/templates/team/settings.hbs | 1 + config/environment.js | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/controllers/team/settings.js b/app/controllers/team/settings.js index f43f907..785864b 100644 --- a/app/controllers/team/settings.js +++ b/app/controllers/team/settings.js @@ -14,10 +14,14 @@ export default Ember.Controller.extend({ var plans = this.store.all('plan'); var plan = plans.findBy('slug', this.get('model.planSlug')); - if(plan.isPaidPlan){ - createStripeToken(requestPlanChange); + console.log(this.get('model.planSlug')) + console.log(plan.get('name')) + console.log(plan.get('amount')) + + if(plan.get('isPaidPlan')){ + this.createStripeToken(requestPlanChange); }else{ - requestPlanChange(); + this.requestPlanChange(); } } }, @@ -38,11 +42,13 @@ export default Ember.Controller.extend({ card_token: this.get('cardToken') } }).then(function(){ + alert("You have changed your plan"); controller.get('model').reload(); }); }, createStripeToken: function(callback){ + Stripe.setPublishableKey('pk_test_2YDSiQNDW9IlNzdADzleLTvQ'); var controller = this; var $form = $('#payment-form'); diff --git a/app/templates/team/settings.hbs b/app/templates/team/settings.hbs index 42740dd..fe7cfc9 100644 --- a/app/templates/team/settings.hbs +++ b/app/templates/team/settings.hbs @@ -1,4 +1,5 @@ +

Setting for {{model.name}}

Your team is currently subscribed to the {{model.planName}}

diff --git a/config/environment.js b/config/environment.js index c2fa54a..d6cf859 100644 --- a/config/environment.js +++ b/config/environment.js @@ -20,12 +20,13 @@ module.exports = function(environment) { /*jshint quotmark: false*/ contentSecurityPolicy: { 'default-src': "'none'", - 'script-src': "'self'", + 'script-src': "'self' https://js.stripe.com", 'font-src': "'self'", 'connect-src': "'self'", 'img-src': "'self'", 'style-src': "'self'", - 'media-src': "'self'" + 'media-src': "'self' https://js.stripe.com", + 'frame-src': "'self' https://js.stripe.com" }, /*jshint quotmark: true*/ subdomainMapping: { From 0f59b9bcf980c7e01b9e3c15a0d4026cd8d64c72 Mon Sep 17 00:00:00 2001 From: israel de la hoz Date: Wed, 13 May 2015 16:22:33 -0500 Subject: [PATCH 4/8] extract stripe settings --- app/controllers/team/settings.js | 21 ++++++++++++--------- app/models/plan.js | 3 ++- config/environment.js | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/controllers/team/settings.js b/app/controllers/team/settings.js index 785864b..7c504f4 100644 --- a/app/controllers/team/settings.js +++ b/app/controllers/team/settings.js @@ -1,6 +1,9 @@ import Ember from 'ember'; -import UrlInfo from 'teamplaybook-ember/lib/url-info'; import ajax from 'ic-ajax'; +import ENV from 'teamplaybook-ember/config/environment'; + +var Stripe = window.Stripe; +var $ = window.$; export default Ember.Controller.extend({ cardToken: null, @@ -14,12 +17,12 @@ export default Ember.Controller.extend({ var plans = this.store.all('plan'); var plan = plans.findBy('slug', this.get('model.planSlug')); - console.log(this.get('model.planSlug')) - console.log(plan.get('name')) - console.log(plan.get('amount')) + console.log(this.get('model.planSlug')); + console.log(plan.get('name')); + console.log(plan.get('amount')); - if(plan.get('isPaidPlan')){ - this.createStripeToken(requestPlanChange); + if(plan.get('isPaid')){ + this.createStripeToken(this.requestPlanChange); }else{ this.requestPlanChange(); } @@ -48,14 +51,14 @@ export default Ember.Controller.extend({ }, createStripeToken: function(callback){ - Stripe.setPublishableKey('pk_test_2YDSiQNDW9IlNzdADzleLTvQ'); + Stripe.setPublishableKey(ENV.STRIPE_PUBLIC_KEY); var controller = this; var $form = $('#payment-form'); - stripeCallback = function(status, response){ + var stripeCallback = function(status, response){ controller.set('cardToken', response.id); callback(); - } + }; Stripe.card.createToken($form, stripeCallback); } }); diff --git a/app/models/plan.js b/app/models/plan.js index c3b76a9..bfb5a48 100644 --- a/app/models/plan.js +++ b/app/models/plan.js @@ -1,9 +1,10 @@ import DS from 'ember-data'; +import Ember from 'ember'; export default DS.Model.extend({ slug: DS.attr('string'), name: DS.attr('string'), trial_period_days: DS.attr('number'), amount: DS.attr('number'), - isPaidPlan: Ember.computed.gt('amount', 0) + isPaid: Ember.computed.gt('amount', 0) }); \ No newline at end of file diff --git a/config/environment.js b/config/environment.js index d6cf859..085e806 100644 --- a/config/environment.js +++ b/config/environment.js @@ -37,7 +37,8 @@ module.exports = function(environment) { routeAfterAuthentication: '/', authorizer: 'authorizer:custom', crossOriginWhitelist: ['*'] - } + }, + STRIPE_PUBLIC_KEY: 'pk_test_2YDSiQNDW9IlNzdADzleLTvQ' }; if (environment === 'development') { From fee0f28c7884de8f6f3527d29ee7323b2dcfe86d Mon Sep 17 00:00:00 2001 From: israel de la hoz Date: Wed, 13 May 2015 16:51:11 -0500 Subject: [PATCH 5/8] hide credit card if no payment is needed --- app/controllers/team/settings.js | 15 +++++++-------- app/templates/team/settings.hbs | 30 ++++++++++++++++-------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/app/controllers/team/settings.js b/app/controllers/team/settings.js index 7c504f4..0933783 100644 --- a/app/controllers/team/settings.js +++ b/app/controllers/team/settings.js @@ -7,6 +7,12 @@ var $ = window.$; export default Ember.Controller.extend({ cardToken: null, + currentPlan: Ember.computed('model.planSlug', function (){ + var plans = this.store.all('plan'); + return plans.findBy('slug', this.get('model.planSlug')); + }), + + currentPlanIsPaid: Ember.computed.alias('currentPlan.isPaid'), plans: Ember.computed(function(){ return this.store.find('plan'); @@ -14,14 +20,7 @@ export default Ember.Controller.extend({ actions:{ changePlan: function(){ - var plans = this.store.all('plan'); - var plan = plans.findBy('slug', this.get('model.planSlug')); - - console.log(this.get('model.planSlug')); - console.log(plan.get('name')); - console.log(plan.get('amount')); - - if(plan.get('isPaid')){ + if(this.get('currentPlanIsPaid')){ this.createStripeToken(this.requestPlanChange); }else{ this.requestPlanChange(); diff --git a/app/templates/team/settings.hbs b/app/templates/team/settings.hbs index fe7cfc9..6a2e5e9 100644 --- a/app/templates/team/settings.hbs +++ b/app/templates/team/settings.hbs @@ -14,19 +14,21 @@ {{/each}} -

Add your credit card information

- -
- - - - - - - - - - -
+{{#if currentPlanIsPaid}} +

This is a paid plan, add your credit card information

+ +
+ + + + + + + + + + +
+{{/if}} \ No newline at end of file From 70101d1f95eae361e78f0479eb7ab1152ff44ab9 Mon Sep 17 00:00:00 2001 From: israel de la hoz Date: Wed, 13 May 2015 18:11:26 -0500 Subject: [PATCH 6/8] fix Jhint --- app/controllers/team/settings.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/team/settings.js b/app/controllers/team/settings.js index 0933783..0e58656 100644 --- a/app/controllers/team/settings.js +++ b/app/controllers/team/settings.js @@ -1,8 +1,8 @@ import Ember from 'ember'; import ajax from 'ic-ajax'; import ENV from 'teamplaybook-ember/config/environment'; +import extractError from 'teamplaybook-ember/lib/extract-error'; -var Stripe = window.Stripe; var $ = window.$; export default Ember.Controller.extend({ @@ -21,7 +21,7 @@ export default Ember.Controller.extend({ actions:{ changePlan: function(){ if(this.get('currentPlanIsPaid')){ - this.createStripeToken(this.requestPlanChange); + this.createStripeToken(this.requestPlanChange.bind(this)); }else{ this.requestPlanChange(); } @@ -34,22 +34,24 @@ export default Ember.Controller.extend({ }, requestPlanChange: function(){ - var controller = this; + var team = this.get('model'); ajax({ type: 'POST', url: this._buildURL('team/change_plan'), data: { - plan_slug: this.get('model.planSlug'), + plan_slug: team.get('planSlug'), card_token: this.get('cardToken') } }).then(function(){ alert("You have changed your plan"); - controller.get('model').reload(); + }, function(response){ + alert(extractError(response)); }); }, createStripeToken: function(callback){ + var Stripe = window.Stripe; Stripe.setPublishableKey(ENV.STRIPE_PUBLIC_KEY); var controller = this; var $form = $('#payment-form'); From 4272c3863281cdae49051f67fcfa628cbd95f6e2 Mon Sep 17 00:00:00 2001 From: israel de la hoz Date: Sat, 16 May 2015 20:10:35 -0500 Subject: [PATCH 7/8] code refactor, merged settings and manage routes --- app/controllers/team/manage.js | 56 +++++++++++++++++++++++++++ app/controllers/team/settings.js | 65 -------------------------------- app/models/plan.js | 2 +- app/router.js | 1 - app/routes/team/settings.js | 8 ---- app/templates/team/manage.hbs | 34 ++++++++++++++++- app/templates/team/settings.hbs | 34 ----------------- 7 files changed, 90 insertions(+), 110 deletions(-) delete mode 100644 app/controllers/team/settings.js delete mode 100644 app/routes/team/settings.js delete mode 100644 app/templates/team/settings.hbs diff --git a/app/controllers/team/manage.js b/app/controllers/team/manage.js index 452cd33..0ce195a 100644 --- a/app/controllers/team/manage.js +++ b/app/controllers/team/manage.js @@ -1,11 +1,24 @@ import Ember from 'ember'; import extractError from 'teamplaybook-ember/lib/extract-error'; +import ajax from 'ic-ajax'; +import ENV from 'teamplaybook-ember/config/environment'; export default Ember.Controller.extend({ showError: false, errorMessage: null, + cardToken: null, + currentPlan: Ember.computed('model.planSlug', function (){ + var plans = this.store.all('plan'); + return plans.findBy('slug', this.get('model.planSlug')); + }), + + currentPlanIsPaid: Ember.computed.alias('currentPlan.isPaid'), + + plans: Ember.computed(function(){ + return this.store.find('plan'); + }), actions: { delete: function() { @@ -26,6 +39,49 @@ export default Ember.Controller.extend({ }); }); } + }, + changePlan: function(){ + if(this.get('currentPlanIsPaid')){ + this.createStripeToken().then(this.requestPlanChange.bind(this)); + }else{ + this.requestPlanChange(); + } } + }, + + _buildURL: function(path) { + var apiUrl = this.get('urlInfo.apiUrl'); + return apiUrl + '/' + path; + }, + + requestPlanChange: function(){ + var team = this.get('model'); + + ajax({ + type: 'POST', + url: this._buildURL('team/change_plan'), + data: { + plan_slug: team.get('planSlug'), + card_token: this.get('cardToken') + } + }).then(function(){ + alert("You have changed your plan"); + }, function(response){ + alert(extractError(response)); + }); + }, + + createStripeToken: function(){ + var Stripe = window.Stripe; + Stripe.setPublishableKey(ENV.STRIPE_PUBLIC_KEY); + var controller = this; + var $form = $('#payment-form'); + + return new Ember.RSVP.Promise(function(resolve) { + Stripe.card.createToken($form, function(status, response) { + controller.set('cardToken', response.id); + resolve(); + }); + }); } }); \ No newline at end of file diff --git a/app/controllers/team/settings.js b/app/controllers/team/settings.js deleted file mode 100644 index 0e58656..0000000 --- a/app/controllers/team/settings.js +++ /dev/null @@ -1,65 +0,0 @@ -import Ember from 'ember'; -import ajax from 'ic-ajax'; -import ENV from 'teamplaybook-ember/config/environment'; -import extractError from 'teamplaybook-ember/lib/extract-error'; - -var $ = window.$; - -export default Ember.Controller.extend({ - cardToken: null, - currentPlan: Ember.computed('model.planSlug', function (){ - var plans = this.store.all('plan'); - return plans.findBy('slug', this.get('model.planSlug')); - }), - - currentPlanIsPaid: Ember.computed.alias('currentPlan.isPaid'), - - plans: Ember.computed(function(){ - return this.store.find('plan'); - }), - - actions:{ - changePlan: function(){ - if(this.get('currentPlanIsPaid')){ - this.createStripeToken(this.requestPlanChange.bind(this)); - }else{ - this.requestPlanChange(); - } - } - }, - - _buildURL: function(path) { - var apiUrl = this.get('urlInfo.apiUrl'); - return apiUrl + '/' + path; - }, - - requestPlanChange: function(){ - var team = this.get('model'); - - ajax({ - type: 'POST', - url: this._buildURL('team/change_plan'), - data: { - plan_slug: team.get('planSlug'), - card_token: this.get('cardToken') - } - }).then(function(){ - alert("You have changed your plan"); - }, function(response){ - alert(extractError(response)); - }); - }, - - createStripeToken: function(callback){ - var Stripe = window.Stripe; - Stripe.setPublishableKey(ENV.STRIPE_PUBLIC_KEY); - var controller = this; - var $form = $('#payment-form'); - - var stripeCallback = function(status, response){ - controller.set('cardToken', response.id); - callback(); - }; - Stripe.card.createToken($form, stripeCallback); - } -}); diff --git a/app/models/plan.js b/app/models/plan.js index bfb5a48..1593c01 100644 --- a/app/models/plan.js +++ b/app/models/plan.js @@ -4,7 +4,7 @@ import Ember from 'ember'; export default DS.Model.extend({ slug: DS.attr('string'), name: DS.attr('string'), - trial_period_days: DS.attr('number'), + trialPeriodDays: DS.attr('number'), amount: DS.attr('number'), isPaid: Ember.computed.gt('amount', 0) }); \ No newline at end of file diff --git a/app/router.js b/app/router.js index 150d6e6..8a0cb27 100644 --- a/app/router.js +++ b/app/router.js @@ -19,7 +19,6 @@ export default Router.map(function() { this.route('team-members', { path: 'members' }, function() { this.route('index', { path: '/' }); }); - this.route('settings'); this.route('manage'); }); } else if (shouldMapGeneralRoutes) { diff --git a/app/routes/team/settings.js b/app/routes/team/settings.js deleted file mode 100644 index 47b6708..0000000 --- a/app/routes/team/settings.js +++ /dev/null @@ -1,8 +0,0 @@ -import Ember from 'ember'; -import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin'; - -export default Ember.Route.extend(AuthenticatedRouteMixin, { - model: function() { - return this.store.find('team', 'current'); - } -}); \ No newline at end of file diff --git a/app/templates/team/manage.hbs b/app/templates/team/manage.hbs index 4f9e444..f37e16e 100644 --- a/app/templates/team/manage.hbs +++ b/app/templates/team/manage.hbs @@ -1,6 +1,38 @@ + +

Team management

{{#if showError}}
{{errorMessage}}
-{{/if}} \ No newline at end of file +{{/if}} + +
+ {{#each plan in plans}} + {{radio-button + value=plan.slug + groupValue=model.planSlug + required=true + name="plan"}} + {{plan.name}} + {{/each}} +
+ +{{#if currentPlanIsPaid}} + +

This is a paid plan, add your credit card information

+ +
+ + + + + + + + + + +
+{{/if}} + \ No newline at end of file diff --git a/app/templates/team/settings.hbs b/app/templates/team/settings.hbs deleted file mode 100644 index 6a2e5e9..0000000 --- a/app/templates/team/settings.hbs +++ /dev/null @@ -1,34 +0,0 @@ - - -

Setting for {{model.name}}

-

Your team is currently subscribed to the {{model.planName}}

- -
- {{#each plan in plans}} - {{radio-button - value=plan.slug - groupValue=model.planSlug - required=true - name="plan"}} - {{plan.name}} - {{/each}} -
- -{{#if currentPlanIsPaid}} - -

This is a paid plan, add your credit card information

- -
- - - - - - - - - - -
-{{/if}} - \ No newline at end of file From 1a25d9de935d03dc826eb9eea199877423895705 Mon Sep 17 00:00:00 2001 From: israel de la hoz Date: Tue, 19 May 2015 16:56:04 -0500 Subject: [PATCH 8/8] get rid of bind --- app/controllers/team/manage.js | 5 ++++- app/templates/team-nav.hbs | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/team/manage.js b/app/controllers/team/manage.js index 0ce195a..0ccdf47 100644 --- a/app/controllers/team/manage.js +++ b/app/controllers/team/manage.js @@ -41,8 +41,11 @@ export default Ember.Controller.extend({ } }, changePlan: function(){ + var controller = this; if(this.get('currentPlanIsPaid')){ - this.createStripeToken().then(this.requestPlanChange.bind(this)); + this.createStripeToken().then(function(){ + controller.requestPlanChange(); + }); }else{ this.requestPlanChange(); } diff --git a/app/templates/team-nav.hbs b/app/templates/team-nav.hbs index e179f0c..42374dd 100644 --- a/app/templates/team-nav.hbs +++ b/app/templates/team-nav.hbs @@ -2,7 +2,6 @@
  • {{#link-to 'team.index'}}Home{{/link-to}}
  • {{#link-to 'team.team-members'}}Members{{/link-to}}
  • -
  • {{#link-to 'team.settings'}}Settings{{/link-to}}
  • {{#if currentUserIsTeamOwner}}
  • {{#link-to 'team.manage'}}Manage team{{/link-to}}
  • {{/if}}