Update the front backbone views to use checkForEditLock
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 16 Nov 2017 19:30:23 +0000 (14:30 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 16 Nov 2017 19:30:23 +0000 (14:30 -0500)
Created function in the global app to use for edit lock checks.

js/frontRegApp.js
js/views/front/regRequestRegistrant.js
js/views/front/regTime.js
views/front/registrations/registration.html

index 664c9f2..b79b5cb 100644 (file)
@@ -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();
index 15111c8..81c1ec6 100644 (file)
@@ -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();
index 2a0cb92..e1e1660 100644 (file)
@@ -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();
index 077c416..b844b9c 100644 (file)
@@ -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 = '';