this.registrants.reset( registrants );
},
+ // Check to see if the current login user in the list of registrants
+ hasMe: function() {
+ if ( loginAccount ) {
+ var foundMe = this.registrants.findWhere({ account: loginAccount.get( 'id' ) });
+ if ( foundMe ) {
+ return true;
+ } else {
+ return false;
+ }
+ return true;
+ } else {
+ return false;
+ }
+ },
+
});
// js/models/regEvent.js
},
render: function(){
- if ( loginAccount === '' ) {
- this.$('.glm-add-account').hide();
- }
this.model.set({ reg_count: this.model.registrants.length });
this.$el.html( this.template( this.model.toJSON() ) );
// Need to see if this class has attendees and render them
});
var accountContainer = this.$('.reg-class-accounts');
accountContainer.append(view);
+ if ( loginAccount === '' ) {
+ this.$('.glm-add-account').hide();
+ }
+ if ( loginAccount != '' && this.model.hasMe() ) {
+ this.$('.glm-add-account').hide();
+ }
return this;
},
addAccount: function(){
// Check to make sure the loginAccount is not empty
if ( loginAccount !== '' ) {
+ this.$('.glm-add-account').hide();
+ // console.log('hiding');
var regRequest = cart.get( 'request' );
var accountEmail = loginAccount.get( 'email' );
var accountId = loginAccount.get( 'id' );
country: country,
});
}
- this.newRegAccount.destroy();
+ // this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.calendar = false;
},
cancelAddNew: function(){
- this.newRegAccount.destroy();
+ // this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.calendar = false;
+ if ( loginAccount != '' && this.model.hasMe() ) {
+ this.$('.glm-add-account').hide();
+ // console.log('hiding');
+ } else if ( loginAccount != '' ) {
+ this.$('.glm-add-account').show();
+ // console.log('showing');
+ }
},
addNewAccount: function(){
},
render: function(){
- if ( loginAccount === '' ) {
- this.$('.glm-add-account').hide();
- }
this.model.set({ reg_count: this.model.registrants.length });
this.$el.html( this.template( this.model.toJSON() ) );
// Need to see if this class has attendees and render them
});
var accountContainer = this.$('.reg-class-accounts');
accountContainer.append(view);
+ if ( loginAccount === '' ) {
+ this.$('.glm-add-account').hide();
+ }
+ if ( loginAccount != '' && this.model.hasMe() ) {
+ this.$('.glm-add-account').hide();
+ }
return this;
},
addAccount: function(){
// Check to make sure the loginAccount is not empty
if ( loginAccount !== '' ) {
+ this.$('.glm-add-account').hide();
+ // console.log('hiding');
var regRequest = cart.get( 'request' );
var accountEmail = loginAccount.get( 'email' );
var accountId = loginAccount.get( 'id' );
country: country,
});
}
- this.newRegAccount.destroy();
+ // this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.calendar = false;
},
cancelAddNew: function(){
- this.newRegAccount.destroy();
+ // this.newRegAccount.destroy();
this.newRegAccountView.remove();
app.calendar = false;
+ if ( loginAccount != '' && this.model.hasMe() ) {
+ this.$('.glm-add-account').hide();
+ // console.log('hiding');
+ } else if ( loginAccount != '' ) {
+ this.$('.glm-add-account').show();
+ // console.log('showing');
+ }
},
addNewAccount: function(){