From: Steve Sutton Date: Tue, 9 Jan 2018 17:04:59 +0000 (-0500) Subject: Fix showing loading graphic when getting error adding attendee. X-Git-Tag: v1.0.0^2~67 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=d21464197dfd53e76628440a04c1d3ec228fdc45;p=WP-Plugins%2Fglm-member-db-registrations.git Fix showing loading graphic when getting error adding attendee. When adding the attendee if you forget the names fields it shows the loading graphic. Fixed so the loading graphic is hidden if an error occurs. --- diff --git a/js/frontRegApp.js b/js/frontRegApp.js index 11a3e52..eec6a21 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -958,6 +958,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ // insert new registrant insertNew: function(){ + // Show the loading Graphic this.$('#loading-' + this.model.get('id') ).show(); var findByEmail = []; var fname = this.$('.add_reg_fname').val().trim(); @@ -977,15 +978,21 @@ app.Views.Front.RegTime = Backbone.View.extend({ } var rateId = this.model.get( 'rate_id' ); if ( !rateId ) { + // Hide the loading graphic + this.$('#loading-' + this.model.get('id') ).hide(); return; } if ( fname === '' || lname === '' ) { alert( 'First and Last name required!' ); + // Hide the loading graphic + this.$('#loading-' + this.model.get('id') ).hide(); return; } if ( email === '' ) { var confAnsw = confirm( 'You have no email address! Are you sure you want to add this registrant?' ); if ( !confAnsw ) { + // Hide the loading graphic + this.$('#loading-' + this.model.get('id') ).hide(); return; } } else { @@ -998,6 +1005,8 @@ app.Views.Front.RegTime = Backbone.View.extend({ var regRequest = cart.get( 'request' ); var parent = this.model.get('parent'); if ( !parent ) { + // Hide the loading graphic + this.$('#loading-' + this.model.get('id') ).hide(); return; } @@ -1032,6 +1041,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ }, successCallback: function( collection, repsonse ){ + // Hide the loading graphic this.$('#loading-' + this.model.get('id') ).hide(); }, diff --git a/js/views/front/regTime.js b/js/views/front/regTime.js index 2ff5167..db63325 100644 --- a/js/views/front/regTime.js +++ b/js/views/front/regTime.js @@ -68,6 +68,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ // insert new registrant insertNew: function(){ + // Show the loading Graphic this.$('#loading-' + this.model.get('id') ).show(); var findByEmail = []; var fname = this.$('.add_reg_fname').val().trim(); @@ -87,15 +88,21 @@ app.Views.Front.RegTime = Backbone.View.extend({ } var rateId = this.model.get( 'rate_id' ); if ( !rateId ) { + // Hide the loading graphic + this.$('#loading-' + this.model.get('id') ).hide(); return; } if ( fname === '' || lname === '' ) { alert( 'First and Last name required!' ); + // Hide the loading graphic + this.$('#loading-' + this.model.get('id') ).hide(); return; } if ( email === '' ) { var confAnsw = confirm( 'You have no email address! Are you sure you want to add this registrant?' ); if ( !confAnsw ) { + // Hide the loading graphic + this.$('#loading-' + this.model.get('id') ).hide(); return; } } else { @@ -108,6 +115,8 @@ app.Views.Front.RegTime = Backbone.View.extend({ var regRequest = cart.get( 'request' ); var parent = this.model.get('parent'); if ( !parent ) { + // Hide the loading graphic + this.$('#loading-' + this.model.get('id') ).hide(); return; } @@ -142,6 +151,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ }, successCallback: function( collection, repsonse ){ + // Hide the loading graphic this.$('#loading-' + this.model.get('id') ).hide(); },