From: Steve Sutton Date: Wed, 3 Jan 2018 18:09:50 +0000 (-0500) Subject: Add cancel buttons in the reg rate class admin side. X-Git-Tag: v1.0.0^2~109 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=c535bd0f2c63835637dcaf0d0cd140568151642e;p=WP-Plugins%2Fglm-member-db-registrations.git Add cancel buttons in the reg rate class admin side. Add cancel button into the markup and functions in backbone.js app. --- diff --git a/js/adminRegApp.js b/js/adminRegApp.js index 910ea0e..fcf6009 100644 --- a/js/adminRegApp.js +++ b/js/adminRegApp.js @@ -229,7 +229,16 @@ app.Views.Admin.RegClass = Backbone.View.extend({ }, cancel: function(){ - this.remove(); + if ( this.model.get( 'id' ) ) { + this.$('.class-display-template').show(); + this.$('.class-edit-template').hide(); + this.$('.class-update').hide(); + this.$('.class-edit').show(); + this.$('.class-delete').show(); + } else { + this.remove(); + } + glmSubmitRequired -= 1; }, edit: function(){ @@ -402,6 +411,17 @@ app.Views.Admin.RegRate = Backbone.View.extend({ 'click .rate-delete': 'delete' }, + cancel: function(){ + if ( this.model.get( 'id') ) { + this.$('.rate-display-template').show(); + this.$('.rate-edit-template').hide(); + this.$('.rate-delete').show(); + } else { + this.remove(); + } + glmSubmitRequired -= 1; + }, + getInputData: function() { var input = { diff --git a/js/views/admin/regClass.js b/js/views/admin/regClass.js index 9098f38..c0de0e4 100644 --- a/js/views/admin/regClass.js +++ b/js/views/admin/regClass.js @@ -98,7 +98,16 @@ app.Views.Admin.RegClass = Backbone.View.extend({ }, cancel: function(){ - this.remove(); + if ( this.model.get( 'id' ) ) { + this.$('.class-display-template').show(); + this.$('.class-edit-template').hide(); + this.$('.class-update').hide(); + this.$('.class-edit').show(); + this.$('.class-delete').show(); + } else { + this.remove(); + } + glmSubmitRequired -= 1; }, edit: function(){ diff --git a/js/views/admin/regRate.js b/js/views/admin/regRate.js index 92363fd..b94d9c8 100644 --- a/js/views/admin/regRate.js +++ b/js/views/admin/regRate.js @@ -22,6 +22,17 @@ app.Views.Admin.RegRate = Backbone.View.extend({ 'click .rate-delete': 'delete' }, + cancel: function(){ + if ( this.model.get( 'id') ) { + this.$('.rate-display-template').show(); + this.$('.rate-edit-template').hide(); + this.$('.rate-delete').show(); + } else { + this.remove(); + } + glmSubmitRequired -= 1; + }, + getInputData: function() { var input = { diff --git a/views/admin/registrations/eventEditLevels.html b/views/admin/registrations/eventEditLevels.html index 295ec20..c6b25e6 100644 --- a/views/admin/registrations/eventEditLevels.html +++ b/views/admin/registrations/eventEditLevels.html @@ -35,6 +35,7 @@