From: Steve Sutton Date: Thu, 16 Nov 2017 19:30:23 +0000 (-0500) Subject: Update the front backbone views to use checkForEditLock X-Git-Tag: v1.0.0^2~263 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=797a9edf79203f38e52c525db1d8fa34922eff1e;p=WP-Plugins%2Fglm-member-db-registrations.git Update the front backbone views to use checkForEditLock Created function in the global app to use for edit lock checks. --- diff --git a/js/frontRegApp.js b/js/frontRegApp.js index 664c9f2..b79b5cb 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -840,8 +840,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ // show the edit form editRegistrant: function(){ - if ( app.regEventLock ) { - alert('Please finish what your doing first!'); + if ( app.checkForEditLock() === true ) { return; } this.$('.reg-edit-form').show(); @@ -911,8 +910,7 @@ 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!'); + if ( app.checkForEditLock() === true ) { return; } this.$('.glm-add-new-account').hide(); diff --git a/js/views/front/regRequestRegistrant.js b/js/views/front/regRequestRegistrant.js index 15111c8..81c1ec6 100644 --- a/js/views/front/regRequestRegistrant.js +++ b/js/views/front/regRequestRegistrant.js @@ -76,8 +76,7 @@ app.Views.Front.RegRequestRegistrant = Backbone.View.extend({ // show the edit form editRegistrant: function(){ - if ( app.regEventLock ) { - alert('Please finish what your doing first!'); + if ( app.checkForEditLock() === true ) { return; } this.$('.reg-edit-form').show(); diff --git a/js/views/front/regTime.js b/js/views/front/regTime.js index 2a0cb92..e1e1660 100644 --- a/js/views/front/regTime.js +++ b/js/views/front/regTime.js @@ -39,8 +39,7 @@ 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!'); + if ( app.checkForEditLock() === true ) { return; } this.$('.glm-add-new-account').hide(); diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index 077c416..b844b9c 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -240,12 +240,21 @@ var app = { var regex = {literal}/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;{/literal} return regex.test(email); }, + regEventLock: false, + checkForEditLock: function(){ + console.log(app.regEventLock); + if ( app.regEventLock === true ) { + alert('Please complete your other edit first.'); + return true; + } else { + return false; + } + }, {if $regEvent.time_specific.value} timeSpecific: true, {else} timeSpecific: false, {/if} - regEventLock: false, }; var regEvent = ''; var cart = '';