Allow toggling settings by clicking on settings icon

[MAILPOET-1974]
This commit is contained in:
Ján Mikláš
2019-05-13 10:26:51 +02:00
committed by M. Shull
parent e0f1b07161
commit ce617c0441

View File

@@ -192,7 +192,7 @@ Module.BlockView = AugmentedView.extend({
Module.BlockToolsView = AugmentedView.extend({
getTemplate: function getTemplate() { return window.templates.genericBlockTools; },
events: {
'click .mailpoet_edit_block': 'changeSettings',
'click .mailpoet_edit_block': 'toggleSettings',
'click .mailpoet_delete_block_activate': 'showDeletionConfirmation',
'click .mailpoet_delete_block_cancel': 'hideDeletionConfirmation',
'click .mailpoet_delete_block_confirm': 'deleteBlock',
@@ -224,6 +224,13 @@ Module.BlockToolsView = AugmentedView.extend({
tools: this.tools,
};
},
toggleSettings: function toggleSettings() {
if (App.getDisplayedSettingsId() === this.model.cid) {
App.getChannel().trigger('hideSettings');
return;
}
this.changeSettings();
},
changeSettings: function changeSettings(options) {
var ViewType = this.getSettingsView();
var displayedSettingsId = App.getDisplayedSettingsId();