Created
November 18, 2012 02:25
-
-
Save shunya/4102987 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
, showAccountView: function(account) { | |
if(this.accountsWatchId){ | |
Services.Accounts.get.unwatch(this.accountsWatchId); | |
delete this.accountsWatchId; | |
} | |
if (!_.isUndefined(this.previousAccount) && _.isEqual(account.attributes, this.previousAccount.attributes)) { | |
return; | |
} | |
var productType = account.get('productType'); | |
if (!_.isUndefined(this.currentProductType) && this.currentProductType == productType) { | |
this.currentProductView.changeAccount(account); | |
} else { | |
if (typeof this.currentProductView != 'undefined') { | |
this.currentProductView.close(); | |
} | |
this.$el.find('.detailsSection').append('<div class="content"></div>'); | |
var childDiv = this.$el.find('.content'); | |
switch (productType) { | |
case 'BANK': | |
this.currentProductView = new CashView({el: childDiv, model: account}); | |
break; | |
case 'CREDIT_CARD': | |
this.currentProductView = new CreditCardView({el: childDiv, model: account}); | |
break; | |
case 'INVESTMENT': | |
this.currentProductView = new InvestmentView({el: childDiv, model: account}); | |
break; | |
case 'LOAN': | |
case 'MORTGAGE': | |
this.currentProductView = new LoanMortgageView({el: childDiv, model: account}); | |
break; | |
} | |
this.currentProductType = productType; | |
} | |
if (!this.holdingsView){ | |
this.holdingsView = new HoldingsDatagridView({el: this.$el.find('.holdingsSection'), userAccountId: account.get('userAccountId')}); | |
} | |
if (typeof this.transactonDatagrid == 'undefined') { | |
this.transactonDatagrid = new TransactionsDatagridView({el: this.$el.find('.datagridSection'), userAccountId: account.get('userAccountId')}); | |
} else { | |
this.transactonDatagrid.changeUserAccount(account.get('userAccountId')); | |
} | |
this.previousAccount = account; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment