replaced React by Twig + JS
This commit is contained in:
@@ -12,3 +12,5 @@
|
|||||||
@require 'box'
|
@require 'box'
|
||||||
@require 'breadcrumb'
|
@require 'breadcrumb'
|
||||||
@require 'form'
|
@require 'form'
|
||||||
|
|
||||||
|
@require 'settings'
|
@@ -1,2 +1,2 @@
|
|||||||
.mailpoet_form td
|
.mailpoet_form td
|
||||||
vertical-align: top
|
vertical-align: top !important
|
2
assets/css/src/settings.styl
Normal file
2
assets/css/src/settings.styl
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.mailpoet_form th
|
||||||
|
width:300px
|
@@ -1,37 +0,0 @@
|
|||||||
define(
|
|
||||||
[
|
|
||||||
'react',
|
|
||||||
'mailpoet',
|
|
||||||
'form/form.jsx'
|
|
||||||
],
|
|
||||||
function(
|
|
||||||
React,
|
|
||||||
MailPoet,
|
|
||||||
Form
|
|
||||||
) {
|
|
||||||
|
|
||||||
var fields = [
|
|
||||||
];
|
|
||||||
|
|
||||||
var messages = {
|
|
||||||
updated: function() {
|
|
||||||
MailPoet.Notice.success('Settings succesfully updated!');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var SettingsForm = React.createClass({
|
|
||||||
render: function() {
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Form
|
|
||||||
endpoint="settings"
|
|
||||||
fields={ fields }
|
|
||||||
params={ this.props.params }
|
|
||||||
messages={ messages } />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return SettingsForm;
|
|
||||||
}
|
|
||||||
);
|
|
@@ -1,243 +0,0 @@
|
|||||||
define(
|
|
||||||
[
|
|
||||||
'react',
|
|
||||||
'mailpoet',
|
|
||||||
'form/form.jsx',
|
|
||||||
'form/fields/field.jsx'
|
|
||||||
],
|
|
||||||
function(
|
|
||||||
React,
|
|
||||||
MailPoet
|
|
||||||
) {
|
|
||||||
|
|
||||||
var BasicsForm = React.createClass({
|
|
||||||
selectInput: function(input) {
|
|
||||||
input.focus();
|
|
||||||
input.select();
|
|
||||||
},
|
|
||||||
render: function() {
|
|
||||||
console.log(this.props);
|
|
||||||
return (
|
|
||||||
<table className="form-table">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">
|
|
||||||
<label htmlFor="settings[notification_email]">
|
|
||||||
Email notifications
|
|
||||||
<p className="description">
|
|
||||||
Enter the email addresses that should receive
|
|
||||||
notifications (separate by comma).
|
|
||||||
</p>
|
|
||||||
</label>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<p>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="regular-text"
|
|
||||||
id="settings[notification_email]"
|
|
||||||
name="mailpoet[settings][notification_email]"
|
|
||||||
defaultValue={ this.props.settings.notification_email }
|
|
||||||
placeholder="notification@mydomain.com" />
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<label htmlFor="settings[notification_on_subscribe]">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
id="settings[notification_on_subscribe]"
|
|
||||||
name="mailpoet[settings][notification_on_subscribe]"
|
|
||||||
value="1" />
|
|
||||||
When someone subscribes
|
|
||||||
</label>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<label htmlFor="settings[notification_on_unsubscribe]">
|
|
||||||
<input type="checkbox"
|
|
||||||
id="settings[notification_on_unsubscribe]"
|
|
||||||
name="mailpoet[settings][notification_on_unsubscribe]"
|
|
||||||
value="1" />
|
|
||||||
When someone unsubscribes
|
|
||||||
</label>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<label htmlFor="settings[notification_daily_report]">
|
|
||||||
<input type="checkbox"
|
|
||||||
id="settings[notification_daily_report]"
|
|
||||||
name="mailpoet[settings][notification_daily_report]"
|
|
||||||
value="1" />
|
|
||||||
Daily summary of emails sent
|
|
||||||
</label>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<label htmlFor="settings[from_name]">
|
|
||||||
From
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="settings[from_name]"
|
|
||||||
name="mailpoet[settings][from_name]"
|
|
||||||
defaultValue={ this.props.settings.from_name }
|
|
||||||
placeholder="Your name" />
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="settings[from_email]"
|
|
||||||
name="mailpoet[settings][from_email]"
|
|
||||||
defaultValue={ this.props.settings.from_email }
|
|
||||||
placeholder="info@mydomain.com" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<label htmlFor="settings[notification_reply_name]">
|
|
||||||
Reply-to
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="settings[notification_reply_name]"
|
|
||||||
name="mailpoet[settings][notification_reply_name]"
|
|
||||||
defaultValue={
|
|
||||||
this.props.settings.notification_reply_name
|
|
||||||
}
|
|
||||||
placeholder="Your name" />
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="settings[notification_reply_email]"
|
|
||||||
name="mailpoet[settings][notification_reply_email]"
|
|
||||||
defaultValue={
|
|
||||||
this.props.settings.notification_reply_email
|
|
||||||
}
|
|
||||||
placeholder="info@mydomain.com" />
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">
|
|
||||||
<label htmlFor="settings[subscribe_on_comment]">
|
|
||||||
Subscribe in comments
|
|
||||||
<p className="description">
|
|
||||||
Visitors who submit a comment on a post can click on
|
|
||||||
a checkbox to subscribe.
|
|
||||||
</p>
|
|
||||||
</label>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<div id="mailpoet_subscribe_on_comment">
|
|
||||||
<p>
|
|
||||||
subscribe_on_comment_label
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th scope="row">
|
|
||||||
<label htmlFor="settings[subscribe_on_register]">
|
|
||||||
Subscribe in registration form
|
|
||||||
<p className="description">
|
|
||||||
Allow users who register to your site to subscribe on
|
|
||||||
a list of your choice.
|
|
||||||
</p>
|
|
||||||
</label>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<p>
|
|
||||||
<input
|
|
||||||
data-toggle="mailpoet_subscribe_in_form"
|
|
||||||
type="checkbox"
|
|
||||||
value="1"
|
|
||||||
id="settings[subscribe_on_register]"
|
|
||||||
name="mailpoet[settings][subscribe_on_register]" />
|
|
||||||
</p>
|
|
||||||
<div id="mailpoet_subscribe_in_form">
|
|
||||||
<p>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="settings[subscribe_on_register_label]"
|
|
||||||
name="mailpoet[settings][subscribe_on_register_label]"
|
|
||||||
value={ this.props.settings.subscribe_on_register_label } />
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
subscribe_on_register_lists
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<em>Registration is disabled on this site.</em>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th scope="row">
|
|
||||||
<label htmlFor="settings[subscription_edit]">
|
|
||||||
Unsubscribe & Manage Subscription page
|
|
||||||
<p className="description">
|
|
||||||
The page your subscribers see when they click to "Unsubscribe" or "Manage your subscription" in your emails.
|
|
||||||
</p>
|
|
||||||
</label>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<p>
|
|
||||||
subscription_edit_page
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<label>Subscribers can choose from these lists :</label>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
subscription_edit_lists
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th scope="row">
|
|
||||||
<label>
|
|
||||||
Archive page shortcode
|
|
||||||
<p className="description">
|
|
||||||
Paste this shortcode in a page to display a list of past newsletters.
|
|
||||||
</p>
|
|
||||||
</label>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<p>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="mailpoet_shortcode_archives"
|
|
||||||
value="[mailpoet_archive]"
|
|
||||||
onClick={ this.selectInput.bind(null, this) }
|
|
||||||
readOnly={ true } />
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
mailpoet_shortcode_archives_list
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">
|
|
||||||
<label>
|
|
||||||
Shortcode to display total number of subscribers
|
|
||||||
<p className="description">
|
|
||||||
Paste this shortcode to display the number of confirmed subscribers in post or page.
|
|
||||||
</p>
|
|
||||||
</label>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<p>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="mailpoet_shortcode_subscribers"
|
|
||||||
value="[mailpoet_subscribers_count]"
|
|
||||||
onClick={ this.selectInput.bind(null, this) }
|
|
||||||
readOnly={ true } />
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
mailpoet_shortcode_subscribers_list
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return BasicsForm;
|
|
||||||
}
|
|
||||||
);
|
|
@@ -1,37 +0,0 @@
|
|||||||
define(
|
|
||||||
[
|
|
||||||
'react',
|
|
||||||
'mailpoet',
|
|
||||||
'form/form.jsx'
|
|
||||||
],
|
|
||||||
function(
|
|
||||||
React,
|
|
||||||
MailPoet,
|
|
||||||
Form
|
|
||||||
) {
|
|
||||||
|
|
||||||
var fields = [
|
|
||||||
];
|
|
||||||
|
|
||||||
var messages = {
|
|
||||||
updated: function() {
|
|
||||||
MailPoet.Notice.success('Settings succesfully updated!');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var SettingsForm = React.createClass({
|
|
||||||
render: function() {
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Form
|
|
||||||
endpoint="settings"
|
|
||||||
fields={ fields }
|
|
||||||
params={ this.props.params }
|
|
||||||
messages={ messages } />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return SettingsForm;
|
|
||||||
}
|
|
||||||
);
|
|
@@ -1,37 +0,0 @@
|
|||||||
define(
|
|
||||||
[
|
|
||||||
'react',
|
|
||||||
'mailpoet',
|
|
||||||
'form/form.jsx'
|
|
||||||
],
|
|
||||||
function(
|
|
||||||
React,
|
|
||||||
MailPoet,
|
|
||||||
Form
|
|
||||||
) {
|
|
||||||
|
|
||||||
var fields = [
|
|
||||||
];
|
|
||||||
|
|
||||||
var messages = {
|
|
||||||
updated: function() {
|
|
||||||
MailPoet.Notice.success('Settings succesfully updated!');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var SettingsForm = React.createClass({
|
|
||||||
render: function() {
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Form
|
|
||||||
endpoint="settings"
|
|
||||||
fields={ fields }
|
|
||||||
params={ this.props.params }
|
|
||||||
messages={ messages } />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return SettingsForm;
|
|
||||||
}
|
|
||||||
);
|
|
@@ -1,122 +0,0 @@
|
|||||||
define(
|
|
||||||
[
|
|
||||||
'react',
|
|
||||||
'react-router',
|
|
||||||
'classnames',
|
|
||||||
'settings/basics.jsx',
|
|
||||||
'settings/signup.jsx',
|
|
||||||
'settings/mta.jsx',
|
|
||||||
'settings/advanced.jsx',
|
|
||||||
'settings/bounce.jsx'
|
|
||||||
],
|
|
||||||
function(
|
|
||||||
React,
|
|
||||||
Router,
|
|
||||||
classNames,
|
|
||||||
Basics,
|
|
||||||
Signup,
|
|
||||||
Mta,
|
|
||||||
Advanced,
|
|
||||||
Bounce
|
|
||||||
) {
|
|
||||||
var DefaultRoute = Router.DefaultRoute;
|
|
||||||
var Link = Router.Link;
|
|
||||||
var Route = Router.Route;
|
|
||||||
var RouteHandler = Router.RouteHandler;
|
|
||||||
var NotFoundRoute = Router.NotFoundRoute;
|
|
||||||
|
|
||||||
var settings = mailpoet_settings || {};
|
|
||||||
|
|
||||||
var Tabs = React.createClass({
|
|
||||||
render: function() {
|
|
||||||
var current_tab = window.location.hash.split('/')[1];
|
|
||||||
var tabs = this.props.tabs.map(function(tab, index) {
|
|
||||||
var tabClasses = classNames(
|
|
||||||
'nav-tab',
|
|
||||||
{ 'nav-tab-active': (current_tab === tab.to) }
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<Link
|
|
||||||
key={ 'tab-' + index }
|
|
||||||
to={ tab.to }
|
|
||||||
className={ tabClasses }
|
|
||||||
>
|
|
||||||
{ tab.label }
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<h2
|
|
||||||
id="mailpoet_settings_tabs"
|
|
||||||
className="nav-tab-wrapper"
|
|
||||||
>
|
|
||||||
{ tabs }
|
|
||||||
</h2>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var App = React.createClass({
|
|
||||||
getInitialState: function() {
|
|
||||||
return {
|
|
||||||
loading: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
render: function() {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<h1>{ MailPoetI18n.pageTitle }</h1>
|
|
||||||
|
|
||||||
<Tabs tabs={ [
|
|
||||||
{ to: 'basics', label: 'Basics'},
|
|
||||||
{ to: 'signup', label: 'Signup Confirmation'},
|
|
||||||
{ to: 'mta', label: 'Send With...'},
|
|
||||||
{ to: 'advanced', label: 'Advanced'},
|
|
||||||
{ to: 'bounce', label: 'Bounce Handling'}
|
|
||||||
]} />
|
|
||||||
|
|
||||||
<form
|
|
||||||
id="mailpoet_settings_form"
|
|
||||||
name="mailpoet_settings_form"
|
|
||||||
autoComplete="off"
|
|
||||||
noValidate
|
|
||||||
>
|
|
||||||
<RouteHandler settings={ settings } />
|
|
||||||
|
|
||||||
<input
|
|
||||||
className="button button-primary"
|
|
||||||
type="submit"
|
|
||||||
value="Save"
|
|
||||||
disabled={this.state.loading} />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var routes = (
|
|
||||||
<Route name="app" path="/" handler={App}>
|
|
||||||
<Route name="basics" path="/basics" handler={Basics} />
|
|
||||||
<Route name="signup" path="/signup" handler={Signup} />
|
|
||||||
<Route name="mta" path="/mta" handler={Mta} />
|
|
||||||
<Route name="advanced" path="/advanced" handler={Advanced} />
|
|
||||||
<Route name="bounce" path="/bounce" handler={Bounce} />
|
|
||||||
<NotFoundRoute handler={Basics} />
|
|
||||||
<DefaultRoute handler={Basics} />
|
|
||||||
</Route>
|
|
||||||
);
|
|
||||||
|
|
||||||
var hook = document.getElementById('mailpoet_settings');
|
|
||||||
if(hook) {
|
|
||||||
Router.run(routes, function(Handler, state) {
|
|
||||||
React.render(
|
|
||||||
<Handler
|
|
||||||
params={state.params}
|
|
||||||
query={state.query} />,
|
|
||||||
hook
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
@@ -1,36 +0,0 @@
|
|||||||
define(
|
|
||||||
[
|
|
||||||
'react',
|
|
||||||
'mailpoet',
|
|
||||||
'form/form.jsx'
|
|
||||||
],
|
|
||||||
function(
|
|
||||||
React,
|
|
||||||
MailPoet,
|
|
||||||
Form
|
|
||||||
) {
|
|
||||||
|
|
||||||
var fields = [
|
|
||||||
];
|
|
||||||
|
|
||||||
var messages = {
|
|
||||||
updated: function() {
|
|
||||||
MailPoet.Notice.success('Settings succesfully updated!');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var SignupForm = React.createClass({
|
|
||||||
render: function() {
|
|
||||||
return (
|
|
||||||
<Form
|
|
||||||
endpoint="settings"
|
|
||||||
fields={ fields }
|
|
||||||
params={ this.props.params }
|
|
||||||
messages={ messages } />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return SignupForm;
|
|
||||||
}
|
|
||||||
);
|
|
@@ -92,7 +92,7 @@ class Menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function settings() {
|
function settings() {
|
||||||
$data = array();
|
// Flags (available features on WP install)
|
||||||
$flags = array();
|
$flags = array();
|
||||||
|
|
||||||
// check if registration is enabled
|
// check if registration is enabled
|
||||||
@@ -104,24 +104,49 @@ class Menu {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// check if users can register
|
// check if users can register
|
||||||
$flags['registration_enabled'] = !(in_array($registration, array('none', 'blog')));
|
$flags['registration_enabled'] =
|
||||||
|
!(in_array($registration, array('none', 'blog')));
|
||||||
} else {
|
} else {
|
||||||
// check if users can register
|
// check if users can register
|
||||||
$flags['registration_enabled'] = (bool)get_option('users_can_register', false);
|
$flags['registration_enabled'] =
|
||||||
|
(bool)get_option('users_can_register', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['flags'] = $flags;
|
// Segments
|
||||||
|
$segments = Segment::findArray();
|
||||||
|
|
||||||
$data['segments'] = Segment::findArray();
|
// Settings
|
||||||
|
$all_settings = Setting::findMany();
|
||||||
$settings = Setting::findMany();
|
$settings = array();
|
||||||
$data['settings'] = array();
|
foreach($all_settings as $setting) {
|
||||||
foreach($settings as $setting) {
|
$settings[$setting->name] = $setting->value;
|
||||||
$data['settings'][$setting->name] = $setting->value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Current user
|
||||||
|
$current_user = wp_get_current_user();
|
||||||
|
|
||||||
|
// WP Pages
|
||||||
|
$mailpoet_pages = get_posts(array('post_type' => 'mailpoet_page'));
|
||||||
|
$pages = array_merge($mailpoet_pages, get_pages());
|
||||||
|
foreach($pages as $key => $page) {
|
||||||
|
// convert page object to array so that we can add some values
|
||||||
|
$page = (array)$page;
|
||||||
|
// get page's preview url
|
||||||
|
$page['preview_url'] = get_permalink($page['ID']);
|
||||||
|
// get page's edit url
|
||||||
|
$page['edit_url'] = get_edit_post_link($page['ID']);
|
||||||
|
// update page data
|
||||||
|
$pages[$key] = $page;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'segments' => $segments,
|
||||||
|
'pages' => $pages,
|
||||||
|
'flags' => $flags,
|
||||||
|
'current_user' => $current_user
|
||||||
|
);
|
||||||
|
|
||||||
echo $this->renderer->render('settings.html', $data);
|
echo $this->renderer->render('settings.html', $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function subscribers() {
|
function subscribers() {
|
||||||
|
@@ -1,15 +1,63 @@
|
|||||||
<% extends 'layout.html' %>
|
<% extends 'layout.html' %>
|
||||||
|
|
||||||
<% block content %>
|
<% block content %>
|
||||||
<div id="mailpoet_settings"></div>
|
<div id="mailpoet_settings">
|
||||||
|
|
||||||
<%= localize({
|
<h1 class="title"><%= __('Settings') %></h1>
|
||||||
'pageTitle': __('Settings')
|
|
||||||
}) %>
|
<!-- settings form -->
|
||||||
|
<form
|
||||||
|
id="mailpoet_settings_form"
|
||||||
|
name="mailpoet_settings_form"
|
||||||
|
class="mailpoet_form"
|
||||||
|
autocomplete="off"
|
||||||
|
>
|
||||||
|
<!-- tabs -->
|
||||||
|
<h2 class="nav-tab-wrapper" id="mailpoet_settings_tabs">
|
||||||
|
<a class="nav-tab nav-tab-active" href="#basics"><%= __('Basics') %></a>
|
||||||
|
<a class="nav-tab" href="#signup"><%= __('Signup Confirmation') %></a>
|
||||||
|
<a class="nav-tab" href="#mta"><%= __('Send With...') %></a>
|
||||||
|
<a class="nav-tab" href="#advanced"><%= __('Advanced') %></a>
|
||||||
|
<a class="nav-tab" href="#bounce"><%= __('Bounce Handling') %></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<!-- basics -->
|
||||||
|
<div id="mailpoet_settings_basics" class="mailpoet_panel">
|
||||||
|
<% include 'settings/basics.html' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- signup confirmation -->
|
||||||
|
<div id="mailpoet_settings_signup" class="mailpoet_panel">
|
||||||
|
<% include 'settings/signup.html' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- sending method -->
|
||||||
|
<div id="mailpoet_settings_mta" class="mailpoet_panel">
|
||||||
|
<% include 'settings/mta.html' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- advanced -->
|
||||||
|
<div id="mailpoet_settings_advanced" class="mailpoet_panel">
|
||||||
|
<% include 'settings/advanced.html' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- bounce -->
|
||||||
|
<div id="mailpoet_settings_bounce" class="mailpoet_panel">
|
||||||
|
<% include 'settings/bounce.html' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<input
|
||||||
|
type="submit"
|
||||||
|
class="button button-primary"
|
||||||
|
name="submit"
|
||||||
|
value="<%= ('Save settings') %>"
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var mailpoet_settings = <%= json_encode(settings) %>;
|
|
||||||
var mailpoet_segments = <%= json_encode(segments) %>;
|
|
||||||
var mailpoet_flags = <%= json_encode(flags) %>;
|
|
||||||
</script>
|
</script>
|
||||||
<% endblock %>
|
<% endblock %>
|
||||||
|
1
views/settings/advanced.html
Normal file
1
views/settings/advanced.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
advanced.html
|
393
views/settings/basics.html
Normal file
393
views/settings/basics.html
Normal file
@@ -0,0 +1,393 @@
|
|||||||
|
<table class="form-table">
|
||||||
|
<tbody>
|
||||||
|
<!-- email addresses receiving notifications -->
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="settings[notification_email]">
|
||||||
|
<%= __("Email notifications") %>
|
||||||
|
<p class="description">
|
||||||
|
<%= __('Enter the email addresses that should receive notifications (separate by comma).') %>
|
||||||
|
</p>
|
||||||
|
</label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<p>
|
||||||
|
<input type="text"
|
||||||
|
id="settings[notification_email]"
|
||||||
|
name="notification_email"
|
||||||
|
value="<%= settings.notification_email %>"
|
||||||
|
placeholder="notification@mydomain.com"
|
||||||
|
class="regular-text" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="settings[notification_on_subscribe]">
|
||||||
|
<input type="checkbox" id="settings[notification_on_subscribe]"
|
||||||
|
name="notification_on_subscribe"
|
||||||
|
value="1"
|
||||||
|
<% if(settings.notification_on_subscribe) %>checked="checked"<% endif %> />
|
||||||
|
<%= __('When someone subscribes') %>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="settings[notification_on_unsubscribe]">
|
||||||
|
<input type="checkbox"
|
||||||
|
id="settings[notification_on_unsubscribe]"
|
||||||
|
name="notification_on_unsubscribe"
|
||||||
|
value="1"
|
||||||
|
<% if(settings.notification_on_unsubscribe) %>checked="checked"<% endif %> />
|
||||||
|
<%= __('When someone unsubscribes') %>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="settings[notification_daily_report]">
|
||||||
|
<input type="checkbox"
|
||||||
|
id="settings[notification_daily_report]"
|
||||||
|
name="notification_daily_report"
|
||||||
|
value="1"
|
||||||
|
<% if(settings.notification_daily_report) %>checked="checked"<% endif %> />
|
||||||
|
<%= __('Daily summary of emails sent') %>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<!-- email notification: from name & email -->
|
||||||
|
<p>
|
||||||
|
<label for="settings[from_name]"><%= __('From') %></label>
|
||||||
|
<input type="text"
|
||||||
|
id="settings[from_name]"
|
||||||
|
name="from_name"
|
||||||
|
value="<%= settings.from_name %>"
|
||||||
|
placeholder="<%= __('Your name') %>" />
|
||||||
|
<input type="text"
|
||||||
|
id="settings[from_email]"
|
||||||
|
name="from_email"
|
||||||
|
value="<%= settings.from_email %>"
|
||||||
|
placeholder="info@mydomain.com" />
|
||||||
|
</p>
|
||||||
|
<!-- email notification: reply_to name & email -->
|
||||||
|
<p>
|
||||||
|
<label for="settings[notification_reply_name]"><%= __('Reply-to') %></label>
|
||||||
|
<input type="text"
|
||||||
|
id="settings[notification_reply_name]"
|
||||||
|
name="notification_reply_name"
|
||||||
|
value="<%= settings.notification_reply_name %>"
|
||||||
|
placeholder="<%= __('Your name') %>" />
|
||||||
|
<input type="text"
|
||||||
|
id="settings[notification_reply_email]"
|
||||||
|
name="notification_reply_email"
|
||||||
|
value="<%= settings.notification_reply_email %>"
|
||||||
|
placeholder="info@mydomain.com" />
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- ability to subscribe in comments -->
|
||||||
|
<!-- TODO: Check if registration is enabled (if not, display a message and disable setting) -->
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="settings[subscribe_on_comment]">
|
||||||
|
<%= __('Subscribe in comments') %>
|
||||||
|
<p class="description"><%= __('Visitors who submit a comment on a post can click on a checkbox to subscribe.') %></p>
|
||||||
|
</label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<p>
|
||||||
|
<input data-toggle="mailpoet_subscribe_on_comment" type="checkbox" value="1" id="settings[subscribe_on_comment]" name="subscribe_on_comment" <% if(settings.subscribe_on_comment) %>checked="checked"<% endif %> />
|
||||||
|
</p>
|
||||||
|
<div id="mailpoet_subscribe_on_comment">
|
||||||
|
<p>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="settings[subscribe_on_comment_label]"
|
||||||
|
name="subscribe_on_comment_label"
|
||||||
|
class="regular-text"
|
||||||
|
<%if(settings.subscribe_on_comment_label) %>
|
||||||
|
value="<%= settings.subscribe_on_comment_label %>"
|
||||||
|
<% else %>
|
||||||
|
value="<%= __('Yes, add me to your mailing list.') %>"
|
||||||
|
<% endif %>
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<select
|
||||||
|
id="mailpoet_subscribe_on_comment_lists"
|
||||||
|
name="subscribe_on_comment_lists[]"
|
||||||
|
placeholder="<%= __('Choose a list') %>"
|
||||||
|
multiple
|
||||||
|
>
|
||||||
|
<% for segment in segments %>
|
||||||
|
<option
|
||||||
|
value="<%= segment.id %>"
|
||||||
|
<% if(segment.id in settings.subscribe_on_comment_lists) %>
|
||||||
|
selected="selected"
|
||||||
|
<% endif %>
|
||||||
|
><%= segment.name %></option>
|
||||||
|
<% endfor %>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- ability to subscribe when registering -->
|
||||||
|
<!-- TODO: Only available for the main site of a multisite! -->
|
||||||
|
<!-- TODO: Check if registration is enabled (if not, display a message and disable setting) -->
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="settings[subscribe_on_register]">
|
||||||
|
<%= __('Subscribe in registration form') %>
|
||||||
|
<p class="description">
|
||||||
|
<%= __('Allow users who register to your site to subscribe on a list of your choice.') %>
|
||||||
|
</p>
|
||||||
|
</label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<% if(flags.registration_enabled == true) %>
|
||||||
|
<p>
|
||||||
|
<input
|
||||||
|
data-toggle="mailpoet_subscribe_in_form"
|
||||||
|
type="checkbox"
|
||||||
|
value="1"
|
||||||
|
id="settings[subscribe_on_register]"
|
||||||
|
name="subscribe_on_register"
|
||||||
|
<% if(settings.subscribe_on_register) %>
|
||||||
|
checked="checked"
|
||||||
|
<% endif %>
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div id="mailpoet_subscribe_in_form">
|
||||||
|
<p>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="settings[subscribe_on_register_label]"
|
||||||
|
name="subscribe_on_register_label"
|
||||||
|
class="regular-text"
|
||||||
|
<%if(settings.subscribe_on_register_label) %>
|
||||||
|
value="<%= settings.subscribe_on_register_label %>"
|
||||||
|
<% else %>
|
||||||
|
value="<%= __('Yes, add me to your mailing list.') %>"
|
||||||
|
<% endif %>
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<select
|
||||||
|
id="mailpoet_subscribe_on_register_lists"
|
||||||
|
name="subscribe_on_register_lists[]"
|
||||||
|
placeholder="<%= __('Choose a list') %>"
|
||||||
|
multiple
|
||||||
|
>
|
||||||
|
<% for segment in segments %>
|
||||||
|
<option
|
||||||
|
value="<%= segment.id %>"
|
||||||
|
<% if(segment.id in settings.subscribe_on_register_lists) %>
|
||||||
|
selected="selected"
|
||||||
|
<% endif %>
|
||||||
|
><%= segment.name %></option>
|
||||||
|
<% endfor %>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<p>
|
||||||
|
<em><%= __('Registration is disabled on this site.') %></em>
|
||||||
|
</p>
|
||||||
|
<% endif %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- manage subscriptions-->
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="settings[subscription_edit]">
|
||||||
|
<%= __('Unsubscribe & Manage Subscription page') %>
|
||||||
|
<p class="description">
|
||||||
|
<%= __('The page your subscribers see when they click to
|
||||||
|
"Unsubscribe" or "Manage your subscription" in your emails.') %>
|
||||||
|
</p>
|
||||||
|
</label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<p>
|
||||||
|
<select
|
||||||
|
class="mailpoet_page_selection"
|
||||||
|
name="subscription_edit_page"
|
||||||
|
>
|
||||||
|
<% for page in pages %>
|
||||||
|
<option
|
||||||
|
value="<%= page.ID %>"
|
||||||
|
data-preview-url="<%= page.preview_url|raw %>"
|
||||||
|
data-edit-url="<%= page.edit_url|raw %>"
|
||||||
|
<% if(page.ID == settings.subscription_edit_page) %>
|
||||||
|
selected="selected"
|
||||||
|
<% endif %>
|
||||||
|
><%= page.post_title %></option>
|
||||||
|
<% endfor %>
|
||||||
|
</select>
|
||||||
|
<a
|
||||||
|
class="mailpoet_page_preview"
|
||||||
|
href="javascript:;"
|
||||||
|
title="<%= __('Preview page') %>"
|
||||||
|
><%= __('Preview') %></a> | <a
|
||||||
|
class="mailpoet_page_edit"
|
||||||
|
href="javascript:;"
|
||||||
|
title="<%= __('Edit page') %>"
|
||||||
|
><%= __('Edit') %></a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label><%= __('Subscribers can choose from these lists :') %></label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<select
|
||||||
|
id="mailpoet_subscription_edit_lists"
|
||||||
|
name="subscription_edit_lists[]"
|
||||||
|
placeholder="<%= __('Leave empty to show all lists') %>"
|
||||||
|
multiple
|
||||||
|
>
|
||||||
|
<% for segment in segments %>
|
||||||
|
<option
|
||||||
|
value="<%= segment.id %>"
|
||||||
|
<% if(segment.id in settings.subscription_edit_lists) %>
|
||||||
|
selected="selected"
|
||||||
|
<% endif %>
|
||||||
|
><%= segment.name %></option>
|
||||||
|
<% endfor %>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- shortcode: archive page -->
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label>
|
||||||
|
<%= __('Archive page shortcode') %>
|
||||||
|
<p class="description">
|
||||||
|
<%= __('Paste this shortcode in a page to display a list of past newsletters.') %>
|
||||||
|
</p>
|
||||||
|
</label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<p>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="regular-text"
|
||||||
|
id="mailpoet_shortcode_archives"
|
||||||
|
value="[mailpoet_archive]"
|
||||||
|
onClick="this.focus();this.select();"
|
||||||
|
readonly="readonly"
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<select
|
||||||
|
id="mailpoet_shortcode_archives_list"
|
||||||
|
data-shortcode="mailpoet_archive"
|
||||||
|
data-output="mailpoet_shortcode_archives"
|
||||||
|
placeholder="<%= __('Leave empty to show all lists') %>"
|
||||||
|
multiple
|
||||||
|
>
|
||||||
|
<% for segment in segments %>
|
||||||
|
<option value="<%= segment.id %>"><%= segment.name %></option>
|
||||||
|
<% endfor %>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- shortcode: total number of subscribers -->
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label>
|
||||||
|
<%= __('Shortcode to display total number of subscribers') %>
|
||||||
|
<p class="description">
|
||||||
|
<%= __('Paste this shortcode to display the number of confirmed subscribers in post or page.') %>
|
||||||
|
</p>
|
||||||
|
</label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<p>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="regular-text"
|
||||||
|
id="mailpoet_shortcode_subscribers"
|
||||||
|
value="[mailpoet_subscribers_count]"
|
||||||
|
onClick="this.focus();this.select();"
|
||||||
|
readonly="readonly"
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<select
|
||||||
|
id="mailpoet_shortcode_subscribers_list"
|
||||||
|
data-shortcode="mailpoet_subscribers_count"
|
||||||
|
data-output="mailpoet_shortcode_subscribers"
|
||||||
|
placeholder="<%= __('Leave empty to show all lists') %>"
|
||||||
|
multiple
|
||||||
|
>
|
||||||
|
<% for segment in segments %>
|
||||||
|
<option value="<%= segment.id %>"><%= segment.name %></option>
|
||||||
|
<% endfor %>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
jQuery(function($) {
|
||||||
|
// on dom loaded
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
// setup toggle checkboxes
|
||||||
|
function toggleContent() {
|
||||||
|
$('#'+$(this).data('toggle'))[
|
||||||
|
($(this).is(':checked'))
|
||||||
|
? 'show'
|
||||||
|
: 'hide'
|
||||||
|
]();
|
||||||
|
}
|
||||||
|
$(document).on('click', 'input[data-toggle]', toggleContent);
|
||||||
|
$('input[data-toggle]').each(toggleContent);
|
||||||
|
|
||||||
|
// page preview
|
||||||
|
$('.mailpoet_page_preview').on('click', function() {
|
||||||
|
var selection = $(this).siblings('.mailpoet_page_selection');
|
||||||
|
|
||||||
|
if(selection.length > 0) {
|
||||||
|
$(this).attr('href', $(selection).find('option[value="'+$(selection).val()+'"]').data('preview-url'));
|
||||||
|
$(this).attr('target', '_blank');
|
||||||
|
} else {
|
||||||
|
$(this).attr('href', 'javascript:;');
|
||||||
|
$(this).removeAttr('target');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// page edit
|
||||||
|
$('.mailpoet_page_edit').on('click', function() {
|
||||||
|
var selection = $(this).siblings('.mailpoet_page_selection');
|
||||||
|
if(selection.length > 0) {
|
||||||
|
$(this).attr('href', $(selection).find('option[value="'+$(selection).val()+'"]').data('edit-url'));
|
||||||
|
$(this).attr('target', '_blank');
|
||||||
|
} else {
|
||||||
|
$(this).attr('href', 'javascript:;');
|
||||||
|
$(this).removeAttr('target');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// select2 instances
|
||||||
|
$('#mailpoet_subscribe_on_comment_lists').select2();
|
||||||
|
$('#mailpoet_subscribe_on_register_lists').select2();
|
||||||
|
$('#mailpoet_subscription_edit_lists').select2();
|
||||||
|
$('#mailpoet_shortcode_archives_list').select2();
|
||||||
|
$('#mailpoet_shortcode_subscribers_list').select2();
|
||||||
|
|
||||||
|
// shortcodes
|
||||||
|
$('#mailpoet_shortcode_archives_list, #mailpoet_shortcode_subscribers_list')
|
||||||
|
.on('change', function() {
|
||||||
|
var shortcode = $(this).data('shortcode'),
|
||||||
|
values = $(this).val() || [];
|
||||||
|
|
||||||
|
if(values.length > 0) {
|
||||||
|
shortcode += ' list_id="';
|
||||||
|
shortcode += values.join(',');
|
||||||
|
shortcode += '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#' + $(this).data('output')).val('[' + shortcode + ']');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
1
views/settings/bounce.html
Normal file
1
views/settings/bounce.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bounce.html
|
1
views/settings/mta.html
Normal file
1
views/settings/mta.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
mta.html
|
1
views/settings/signup.html
Normal file
1
views/settings/signup.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
signup.html
|
@@ -66,7 +66,6 @@ config.push(_.extend({}, baseConfig, {
|
|||||||
'jquery.serialize_object'
|
'jquery.serialize_object'
|
||||||
],
|
],
|
||||||
admin: [
|
admin: [
|
||||||
'settings/settings.jsx',
|
|
||||||
'subscribers/subscribers.jsx',
|
'subscribers/subscribers.jsx',
|
||||||
'newsletters/newsletters.jsx',
|
'newsletters/newsletters.jsx',
|
||||||
'segments/segments.jsx'
|
'segments/segments.jsx'
|
||||||
|
Reference in New Issue
Block a user