Add cancel button into the markup and functions in backbone.js app.
},
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(){
'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 = {
},
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(){
'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 = {
<div class="class-edit-template" style="display: none;">
<div class="glm-class-header">
<div class="glm-right">
+ <a class="class-cancel button glm-button-small">Cancel</a>
<a class="class-update button glm-button-small-highlighted">Update</a>
<a class="class-add button glm-button-small-highlighted" style="display: none;">Add</a>
<a class="class-delete button button-secondary glm-button-small">Delete</a>
<div class="rate-edit-template" style="display: none; border: 1px solid black; padding: 1em; background-color: #f8ffff;">
<div class="glm-rate-header">
<div class="glm-right">
+ <a class="rate-cancel button glm-button-small">Cancel</a>
<a class="rate-update button glm-button-small-highlighted">Update</a>
<a class="rate-add button glm-button-small-highlighted" style="display: none;">Add</a>
<a class="rate-delete button button-secondary glm-button-small">Delete</a>