From 797a9edf79203f38e52c525db1d8fa34922eff1e Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 16 Nov 2017 14:30:23 -0500 Subject: [PATCH] Update the front backbone views to use checkForEditLock Created function in the global app to use for edit lock checks. --- js/frontRegApp.js | 6 ++---- js/views/front/regRequestRegistrant.js | 3 +-- js/views/front/regTime.js | 3 +-- views/front/registrations/registration.html | 11 ++++++++++- 4 files changed, 14 insertions(+), 9 deletions(-) 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 = ''; -- 2.17.1