Remove old settings files
[MAILPOET-2682]
This commit is contained in:
committed by
Veljko V
parent
a37732cfb1
commit
c19902c32d
@@ -1,87 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { partial } from 'underscore';
|
||||
import MailPoet from 'mailpoet';
|
||||
import SenderEmailAddressWarning from 'common/sender_email_address_warning.jsx';
|
||||
|
||||
class DefaultSender extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
senderAddress: props.senderAddress,
|
||||
senderName: props.senderName,
|
||||
replyToName: props.replyToName,
|
||||
replyToAddress: props.replyToAddress,
|
||||
};
|
||||
this.onChange = this.onChange.bind(this);
|
||||
}
|
||||
|
||||
onChange(field, e) {
|
||||
const newState = {};
|
||||
newState[field] = e.target.value;
|
||||
this.setState(newState);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<p>
|
||||
<label htmlFor="settings[from_name]">{MailPoet.I18n.t('from')}</label>
|
||||
<input
|
||||
type="text"
|
||||
id="settings[from_name]"
|
||||
data-automation-id="settings-page-from-name-field"
|
||||
name="sender[name]"
|
||||
value={this.state.senderName}
|
||||
onChange={partial(this.onChange, 'senderName')}
|
||||
placeholder={MailPoet.I18n.t('yourName')}
|
||||
/>
|
||||
<input
|
||||
type="email"
|
||||
id="settings[from_email]"
|
||||
name="sender[address]"
|
||||
data-automation-id="settings-page-from-email-field"
|
||||
value={this.state.senderAddress}
|
||||
onChange={partial(this.onChange, 'senderAddress')}
|
||||
placeholder="from@mydomain.com"
|
||||
/>
|
||||
</p>
|
||||
<div className="regular-text">
|
||||
<SenderEmailAddressWarning
|
||||
emailAddress={this.state.senderAddress}
|
||||
mssActive={this.props.mssActive}
|
||||
/>
|
||||
</div>
|
||||
<p>
|
||||
<label htmlFor="settings[reply_name]">{MailPoet.I18n.t('replyTo')}</label>
|
||||
<input
|
||||
type="text"
|
||||
id="settings[reply_name]"
|
||||
name="reply_to[name]"
|
||||
value={this.state.replyToName}
|
||||
onChange={partial(this.onChange, 'replyToName')}
|
||||
placeholder={MailPoet.I18n.t('yourName')}
|
||||
/>
|
||||
<input
|
||||
type="email"
|
||||
id="settings[reply_email]"
|
||||
name="reply_to[address]"
|
||||
value={this.state.replyToAddress}
|
||||
onChange={partial(this.onChange, 'replyToAddress')}
|
||||
placeholder="reply_to@mydomain.com"
|
||||
/>
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
DefaultSender.propTypes = {
|
||||
senderAddress: PropTypes.string.isRequired,
|
||||
senderName: PropTypes.string.isRequired,
|
||||
replyToAddress: PropTypes.string.isRequired,
|
||||
replyToName: PropTypes.string.isRequired,
|
||||
mssActive: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
export default DefaultSender;
|
@@ -1,37 +0,0 @@
|
||||
import MailPoet from 'mailpoet';
|
||||
|
||||
var element;
|
||||
function eventHandler() {
|
||||
if (confirm(MailPoet.I18n.t('reinstallConfirmation'))) { // eslint-disable-line
|
||||
MailPoet.trackEvent(
|
||||
'User has reinstalled MailPoet via Settings',
|
||||
{ 'MailPoet Free version': window.mailpoet_version }
|
||||
);
|
||||
|
||||
MailPoet.Modal.loading(true);
|
||||
MailPoet.Ajax.post({
|
||||
api_version: window.mailpoet_api_version,
|
||||
endpoint: 'setup',
|
||||
action: 'reset',
|
||||
}).always(function alwaysCb() {
|
||||
MailPoet.Modal.loading(false);
|
||||
}).done(function doneCb() {
|
||||
window.location = 'admin.php?page=mailpoet-newsletters';
|
||||
}).fail(function failCb(response) {
|
||||
if (response.errors.length > 0) {
|
||||
MailPoet.Notice.error(
|
||||
response.errors.map(function responseMapCb(error) {
|
||||
return error.message;
|
||||
}),
|
||||
{ scroll: true }
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
element = document.getElementById('mailpoet_reinstall');
|
||||
if (element) {
|
||||
element.addEventListener('click', eventHandler, false);
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import DefaultSender from 'old_settings/default_sender.jsx';
|
||||
import { GlobalContext, useGlobalContextValue } from 'context/index.jsx';
|
||||
import Notices from 'notices/notices.jsx';
|
||||
|
||||
const App = () => (
|
||||
<GlobalContext.Provider value={useGlobalContextValue(window)}>
|
||||
<Notices />
|
||||
<DefaultSender
|
||||
senderAddress={window.mailpoet_settings_sender_adddress}
|
||||
senderName={window.mailpoet_settings_sender_name}
|
||||
replyToAddress={window.mailpoet_settings_reply_to_address}
|
||||
replyToName={window.mailpoet_settings_reply_to_name}
|
||||
mssActive={window.mailpoet_mss_active}
|
||||
/>
|
||||
</GlobalContext.Provider>
|
||||
);
|
||||
|
||||
const settingsSenderContainer = document.getElementById('settings_sender_container');
|
||||
|
||||
if (settingsSenderContainer) {
|
||||
ReactDOM.render(<App />, settingsSenderContainer);
|
||||
}
|
@@ -1,96 +0,0 @@
|
||||
import Backbone from 'backbone';
|
||||
import jQuery from 'jquery';
|
||||
import mp from 'mailpoet';
|
||||
|
||||
var MailPoet = mp;
|
||||
if (jQuery('#mailpoet_settings').length > 0) {
|
||||
MailPoet.Router = new (Backbone.Router.extend({
|
||||
routes: {
|
||||
'': 'defaultRoute',
|
||||
'mta(/:group)': 'sendingMethodGroup',
|
||||
'(:tab)': 'tabs',
|
||||
},
|
||||
defaultRoute: function defaultRoute() {
|
||||
// redirect to new settings by default
|
||||
window.location.href = '?page=mailpoet-new-settings#/basics';
|
||||
},
|
||||
sendingMethodGroup: function sendingMethodGroup(group) {
|
||||
window.location.href = '?page=mailpoet-new-settings#/mta/' + (group || '');
|
||||
},
|
||||
tabs: function tabs(tab) {
|
||||
if (tab === 'basics') {
|
||||
window.location.href = '?page=mailpoet-new-settings#/basics';
|
||||
}
|
||||
if (tab === 'woocommerce') {
|
||||
if (!window.mailpoet_woocommerce_active) {
|
||||
window.location.href = '?page=mailpoet-new-settings#/basics';
|
||||
} else {
|
||||
window.location.href = '?page=mailpoet-new-settings#/woocommerce';
|
||||
}
|
||||
}
|
||||
if (tab === 'premium') {
|
||||
window.location.href = '?page=mailpoet-new-settings#/premium';
|
||||
}
|
||||
if (tab === 'signup') {
|
||||
window.location.href = '?page=mailpoet-new-settings#/signup';
|
||||
}
|
||||
if (tab === 'advanced') {
|
||||
window.location.href = '?page=mailpoet-new-settings#/advanced';
|
||||
}
|
||||
// reset all active tabs
|
||||
jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active');
|
||||
|
||||
// hide panels & sections
|
||||
jQuery('.mailpoet_tab_panel, .mailpoet_section').hide();
|
||||
|
||||
// set active tab
|
||||
jQuery('a.nav-tab[href="#' + tab + '"]').addClass('nav-tab-active').blur();
|
||||
|
||||
// show selected panel
|
||||
if (jQuery('.mailpoet_tab_panel[data-tab="' + tab + '"]').length > 0) {
|
||||
jQuery('.mailpoet_tab_panel[data-tab="' + tab + '"]').show();
|
||||
}
|
||||
|
||||
// show "save settings" button
|
||||
if (tab !== 'premium') {
|
||||
jQuery('.mailpoet_settings_submit').show();
|
||||
}
|
||||
|
||||
// add 'nav-tab-reload' to all tabs when on '#premium'
|
||||
if (tab === 'premium') {
|
||||
jQuery('.nav-tab-wrapper .nav-tab').addClass('nav-tab-reload');
|
||||
}
|
||||
|
||||
MailPoet.trackEvent(
|
||||
'User has clicked a tab in Settings',
|
||||
{
|
||||
'MailPoet Free version': window.mailpoet_version,
|
||||
'Tab ID': tab,
|
||||
}
|
||||
);
|
||||
},
|
||||
}))();
|
||||
|
||||
// force full reload when going from/to '#premium' page
|
||||
window.addEventListener('hashchange', function hashchange(e) {
|
||||
e.preventDefault();
|
||||
const oldHash = e.oldURL.split('#')[1] || null;
|
||||
const newHash = e.newURL.split('#')[1] || null;
|
||||
if (oldHash === 'premium' || newHash === 'premium') {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(document).ready(function ready() {
|
||||
if (!Backbone.History.started) Backbone.history.start();
|
||||
|
||||
// force full tab reload for tabs with 'nav-tab-reload' class
|
||||
jQuery('.nav-tab').click(function click(e) {
|
||||
if (e.target.classList.contains('nav-tab-reload')) {
|
||||
e.preventDefault();
|
||||
window.history.replaceState(null, null, e.target.href);
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
@@ -8,11 +8,8 @@ import 'newsletters/automatic_emails.jsx'; // side effect - sets up automatic em
|
||||
import 'subscribers/subscribers.jsx'; // side effect - renders ReactDOM to document
|
||||
import 'newsletters/newsletters.jsx'; // side effect - renders ReactDOM to window
|
||||
import 'segments/segments.jsx'; // side effect - renders ReactDOM to document
|
||||
import 'old_settings/settings.jsx'; // side effect - renders ReactDOM to document
|
||||
import 'forms/forms.jsx'; // side effect - renders ReactDOM to document
|
||||
import 'old_settings/tabs.js'; // side effect - assigns to MailPoet.Router, executes code on doc ready
|
||||
import 'help/help.jsx'; // side effect - renders ReactDOM to document
|
||||
import 'old_settings/reinstall_from_scratch.js'; // side effect - adds event handler to document
|
||||
import 'subscribers/importExport/import.jsx'; // side effect - executes on doc ready, adds events
|
||||
import 'subscribers/importExport/export.js'; // side effect - executes on doc ready
|
||||
import 'wizard/wizard.jsx'; // side effect - renders ReactDOM to document
|
||||
|
Reference in New Issue
Block a user