Show Basics tab when accessing WC tab without WC active

[MAILPOET-2408]
This commit is contained in:
Ján Mikláš
2019-10-10 17:38:06 +02:00
committed by Jack Kitterhing
parent a5129b3293
commit b6a38d9209

View File

@@ -10,11 +10,11 @@ if (jQuery('#mailpoet_settings').length > 0) {
'mta(/:group)': 'sendingMethodGroup', 'mta(/:group)': 'sendingMethodGroup',
'(:tab)': 'tabs', '(:tab)': 'tabs',
}, },
defaultRoute: function () { // eslint-disable-line func-names defaultRoute: function defaultRoute() {
// display basics tab as default // display basics tab as default
this.tabs('basics'); this.tabs('basics');
}, },
sendingMethodGroup: function (group) { // eslint-disable-line func-names sendingMethodGroup: function sendingMethodGroup(group) {
// display mta tab // display mta tab
this.tabs('mta'); this.tabs('mta');
@@ -45,7 +45,11 @@ if (jQuery('#mailpoet_settings').length > 0) {
jQuery('#mailpoet_sending_method_setup').fadeIn(); jQuery('#mailpoet_sending_method_setup').fadeIn();
} }
}, },
tabs: function (tab) { // eslint-disable-line func-names tabs: function tabs(tab) {
if (tab === 'woocommerce' && !window.mailpoet_woocommerce_active) {
window.location.hash = '#basics';
return;
}
// reset all active tabs // reset all active tabs
jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active'); jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active');
@@ -73,7 +77,7 @@ if (jQuery('#mailpoet_settings').length > 0) {
}, },
}))(); }))();
jQuery(document).ready(function () { // eslint-disable-line func-names jQuery(document).ready(function ready() {
if (!Backbone.History.started) Backbone.history.start(); if (!Backbone.History.started) Backbone.history.start();
}); });
} }