From: Steve Sutton Date: Thu, 16 Nov 2017 19:13:05 +0000 (-0500) Subject: fix bug in admin X-Git-Tag: v1.0.0^2~264 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a5c284a3e9d1e1bf6fe3b8279444b1101e519585;p=WP-Plugins%2Fglm-member-db-registrations.git fix bug in admin also setting up a lock to make sure your editing adding only one thing at a time. --- diff --git a/js/adminRegApp.js b/js/adminRegApp.js index 7d60191..910ea0e 100644 --- a/js/adminRegApp.js +++ b/js/adminRegApp.js @@ -378,7 +378,7 @@ app.Views.Admin.RegEvent = Backbone.View.extend({ }); -js/views/regRate.js +//js/views/regRate.js var calendar = false; diff --git a/js/frontRegApp.js b/js/frontRegApp.js index 2c8dce4..664c9f2 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -829,16 +829,23 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ } this.$('.reg-edit-form').hide(); + app.regEventLock = false; }, // cancel the edit of model cancelEdit: function(){ this.$('.reg-edit-form').hide(); + app.regEventLock = false; }, // show the edit form editRegistrant: function(){ + if ( app.regEventLock ) { + alert('Please finish what your doing first!'); + return; + } this.$('.reg-edit-form').show(); + app.regEventLock = true; }, // render the view @@ -903,6 +910,11 @@ app.Views.Front.RegTime = Backbone.View.extend({ // add new account addNewAccount: function(){ + // check for the lock + if ( app.regEventLock ) { + alert('Please finish what your doing first!'); + return; + } this.$('.glm-add-new-account').hide(); // Create the new Registrant View if ( app.timeSpecific ) { @@ -912,6 +924,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ } this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount}); this.$el.append( this.newRegAccountView.render().el ); + app.regEventLock = true; }, // insert new registrant @@ -975,7 +988,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ } // this.newRegAccount.destroy(); this.newRegAccountView.remove(); - // app.calendar = false; + app.regEventLock = false; }, // cancel add new registrant @@ -983,6 +996,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ this.$('.glm-add-new-account').show(); // this.newRegAccount.destroy(); this.newRegAccountView.remove(); + app.regEventLock = false; }, // add a registrant to collection diff --git a/js/views/admin/regRate.js b/js/views/admin/regRate.js index 2587b55..92363fd 100644 --- a/js/views/admin/regRate.js +++ b/js/views/admin/regRate.js @@ -1,4 +1,4 @@ -js/views/regRate.js +//js/views/regRate.js var calendar = false; diff --git a/js/views/front/regRequestRegistrant.js b/js/views/front/regRequestRegistrant.js index f1be6a2..15111c8 100644 --- a/js/views/front/regRequestRegistrant.js +++ b/js/views/front/regRequestRegistrant.js @@ -65,16 +65,23 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ } this.$('.reg-edit-form').hide(); + app.regEventLock = false; }, // cancel the edit of model cancelEdit: function(){ this.$('.reg-edit-form').hide(); + app.regEventLock = false; }, // show the edit form editRegistrant: function(){ + if ( app.regEventLock ) { + alert('Please finish what your doing first!'); + return; + } this.$('.reg-edit-form').show(); + app.regEventLock = true; }, // render the view diff --git a/js/views/front/regTime.js b/js/views/front/regTime.js index b9afd57..2a0cb92 100644 --- a/js/views/front/regTime.js +++ b/js/views/front/regTime.js @@ -38,6 +38,11 @@ app.Views.Front.RegTime = Backbone.View.extend({ // add new account addNewAccount: function(){ + // check for the lock + if ( app.regEventLock ) { + alert('Please finish what your doing first!'); + return; + } this.$('.glm-add-new-account').hide(); // Create the new Registrant View if ( app.timeSpecific ) { @@ -47,6 +52,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ } this.newRegAccountView = new app.Views.Front.RegistrantForm({model: this.newRegAccount}); this.$el.append( this.newRegAccountView.render().el ); + app.regEventLock = true; }, // insert new registrant @@ -110,7 +116,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ } // this.newRegAccount.destroy(); this.newRegAccountView.remove(); - // app.calendar = false; + app.regEventLock = false; }, // cancel add new registrant @@ -118,6 +124,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ this.$('.glm-add-new-account').show(); // this.newRegAccount.destroy(); this.newRegAccountView.remove(); + app.regEventLock = false; }, // add a registrant to collection diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index b0b72eb..077c416 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -245,6 +245,7 @@ var app = { {else} timeSpecific: false, {/if} + regEventLock: false, }; var regEvent = ''; var cart = '';