Make save-as-template & export-as-template toggable identically to options
There was no option how to close save-as-template and export-as-template windows. This makes them closable in the same way as dropdown options are. [MAILPOET-1448]
This commit is contained in:
@@ -124,10 +124,10 @@ define([
|
|||||||
'click .mailpoet_save_show_options': 'toggleSaveOptions',
|
'click .mailpoet_save_show_options': 'toggleSaveOptions',
|
||||||
'click .mailpoet_save_next': 'next',
|
'click .mailpoet_save_next': 'next',
|
||||||
/* Save as template */
|
/* Save as template */
|
||||||
'click .mailpoet_save_template': 'toggleSaveAsTemplate',
|
'click .mailpoet_save_template': 'showSaveAsTemplate',
|
||||||
'click .mailpoet_save_as_template': 'saveAsTemplate',
|
'click .mailpoet_save_as_template': 'saveAsTemplate',
|
||||||
/* Export template */
|
/* Export template */
|
||||||
'click .mailpoet_save_export': 'toggleExportTemplate',
|
'click .mailpoet_save_export': 'showExportTemplate',
|
||||||
'click .mailpoet_export_template': 'exportTemplate'
|
'click .mailpoet_export_template': 'exportTemplate'
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ define([
|
|||||||
this.validateNewsletter(App.toJSON());
|
this.validateNewsletter(App.toJSON());
|
||||||
},
|
},
|
||||||
save: function () {
|
save: function () {
|
||||||
this.hideOptionContents();
|
this.hideSaveOptions();
|
||||||
App.getChannel().request('save');
|
App.getChannel().request('save');
|
||||||
},
|
},
|
||||||
beforeSave: function () {
|
beforeSave: function () {
|
||||||
@@ -159,17 +159,27 @@ define([
|
|||||||
this.$('.mailpoet_editor_last_saved').removeClass('mailpoet_hidden');
|
this.$('.mailpoet_editor_last_saved').removeClass('mailpoet_hidden');
|
||||||
this.$('.mailpoet_autosaved_at').text('');
|
this.$('.mailpoet_autosaved_at').text('');
|
||||||
},
|
},
|
||||||
toggleSaveOptions: function () {
|
showSaveOptions: function () {
|
||||||
this.$('.mailpoet_save_options').toggleClass('mailpoet_hidden');
|
this.$('.mailpoet_save_show_options').addClass('mailpoet_save_show_options_active');
|
||||||
this.$('.mailpoet_save_show_options').toggleClass('mailpoet_save_show_options_active');
|
this.$('.mailpoet_save_options').removeClass('mailpoet_hidden');
|
||||||
|
this.hideSaveAsTemplate();
|
||||||
|
this.hideExportTemplate();
|
||||||
},
|
},
|
||||||
toggleSaveAsTemplate: function () {
|
hideSaveOptions: function () {
|
||||||
this.$('.mailpoet_save_as_template_container').toggleClass('mailpoet_hidden');
|
this.$('.mailpoet_save_show_options').removeClass('mailpoet_save_show_options_active');
|
||||||
this.toggleSaveOptions();
|
this.$('.mailpoet_save_options').addClass('mailpoet_hidden');
|
||||||
|
this.hideSaveAsTemplate();
|
||||||
|
this.hideExportTemplate();
|
||||||
|
},
|
||||||
|
toggleSaveOptions: function () {
|
||||||
|
if (this.$('.mailpoet_save_show_options').hasClass('mailpoet_save_show_options_active')) {
|
||||||
|
this.hideSaveOptions();
|
||||||
|
} else {
|
||||||
|
this.showSaveOptions();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
showSaveAsTemplate: function () {
|
showSaveAsTemplate: function () {
|
||||||
this.$('.mailpoet_save_as_template_container').removeClass('mailpoet_hidden');
|
this.$('.mailpoet_save_as_template_container').removeClass('mailpoet_hidden');
|
||||||
this.toggleSaveOptions();
|
|
||||||
},
|
},
|
||||||
hideSaveAsTemplate: function () {
|
hideSaveAsTemplate: function () {
|
||||||
this.$('.mailpoet_save_as_template_container').addClass('mailpoet_hidden');
|
this.$('.mailpoet_save_as_template_container').addClass('mailpoet_hidden');
|
||||||
@@ -209,12 +219,11 @@ define([
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
this.hideOptionContents();
|
this.hideSaveOptions();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggleExportTemplate: function () {
|
showExportTemplate: function () {
|
||||||
this.$('.mailpoet_export_template_container').toggleClass('mailpoet_hidden');
|
this.$('.mailpoet_export_template_container').removeClass('mailpoet_hidden');
|
||||||
this.toggleSaveOptions();
|
|
||||||
},
|
},
|
||||||
hideExportTemplate: function () {
|
hideExportTemplate: function () {
|
||||||
this.$('.mailpoet_export_template_container').addClass('mailpoet_hidden');
|
this.$('.mailpoet_export_template_container').addClass('mailpoet_hidden');
|
||||||
@@ -238,13 +247,8 @@ define([
|
|||||||
this.hideExportTemplate();
|
this.hideExportTemplate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hideOptionContents: function () {
|
|
||||||
this.hideSaveAsTemplate();
|
|
||||||
this.hideExportTemplate();
|
|
||||||
this.$('.mailpoet_save_options').addClass('mailpoet_hidden');
|
|
||||||
},
|
|
||||||
next: function () {
|
next: function () {
|
||||||
this.hideOptionContents();
|
this.hideSaveOptions();
|
||||||
if (!this.$('.mailpoet_save_next').hasClass('button-disabled')) {
|
if (!this.$('.mailpoet_save_next').hasClass('button-disabled')) {
|
||||||
Module._cancelAutosave();
|
Module._cancelAutosave();
|
||||||
Module.save().done(function () {
|
Module.save().done(function () {
|
||||||
|
Reference in New Issue
Block a user