Add WC customizer activation button to the editor [MAILPOET-2520]
This commit is contained in:
@ -112,6 +112,7 @@ Module.SaveView = Marionette.View.extend({
|
||||
return {
|
||||
wrapperClass: this.wrapperClass,
|
||||
isWoocommerceTransactional: this.model.isWoocommerceTransactional(),
|
||||
woocommerceCustomizerEnabled: App.getConfig().get('woocommerceCustomizerEnabled'),
|
||||
};
|
||||
},
|
||||
events: {
|
||||
@ -124,6 +125,8 @@ Module.SaveView = Marionette.View.extend({
|
||||
/* Export template */
|
||||
'click .mailpoet_save_export': 'showExportTemplate',
|
||||
'click .mailpoet_export_template': 'exportTemplate',
|
||||
/* WooCommerce */
|
||||
'click .mailpoet_save_activate_wc_customizer_button': 'activateWooCommerceCustomizer',
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
@ -302,6 +305,21 @@ Module.SaveView = Marionette.View.extend({
|
||||
this.$('.mailpoet_save_error').addClass('mailpoet_hidden');
|
||||
this.$('.mailpoet_save_next').removeClass('button-disabled');
|
||||
},
|
||||
activateWooCommerceCustomizer: function () {
|
||||
var $el = this.$('.mailpoet_save_woocommerce_customizer_disabled');
|
||||
return MailPoet.Ajax.post({
|
||||
api_version: window.mailpoet_api_version,
|
||||
endpoint: 'settings',
|
||||
action: 'set',
|
||||
data: {
|
||||
'woocommerce.use_mailpoet_editor': 1,
|
||||
},
|
||||
}).done(function () {
|
||||
$el.addClass('mailpoet_hidden');
|
||||
}).fail(function (response) {
|
||||
MailPoet.Notice.showApiErrorNotice(response, { scroll: true });
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Module.autoSave = function () {
|
||||
|
Reference in New Issue
Block a user