Compare commits

...

49 Commits

Author SHA1 Message Date
f35b66b3cf Release 3.0.0-rc.1.0.2 2017-08-08 17:45:04 +03:00
7900e7eb8d Merge pull request #1035 from mailpoet/new-poll
New poll [MAILPOET-1018]
2017-08-08 09:17:41 -04:00
849a24ced7 Merge pull request #1019 from mailpoet/translate
translate the DB error message [MAILPOET-1019]
2017-08-08 13:08:54 +03:00
f7e73b06be added missing argument 2017-08-08 10:02:51 +00:00
52cbb9fcb2 Merge pull request #1032 from mailpoet/css-form
Update form css [MAILPOET-593]
2017-08-08 11:48:09 +02:00
966ec0cb7a New poll
[MAILPOET-1018]
2017-08-03 13:17:37 +02:00
2ff0d40d10 Updates reference to the hook that displays IIS error 2017-08-03 08:14:46 +02:00
bb249ebe09 Removes leftover debug code 2017-08-02 10:24:35 -04:00
5a57029b38 Bumps up release version & updates changelog 2017-08-02 10:23:37 -04:00
84d427cc4c Upate poll url 2017-08-02 11:40:30 +02:00
22efd2109b Release 3.0.0-rc.1.0.0 2017-08-01 18:04:30 +00:00
f044db5745 Update form css
[MAILPOET-593]
2017-08-01 11:28:53 +02:00
0865995d21 Does not remove padding from the last element in a column 2017-08-01 09:47:29 +02:00
7c30192a03 Adds option to replace shortcodes in one string using contents from
another string
Adds unit tests
2017-08-01 09:32:42 +02:00
334c3ff420 Returns false when data-post-id tag is not found
Uses all post types, including custom, when querying posts
2017-08-01 09:32:42 +02:00
6d738ddb3b Merge pull request #1031 from mailpoet/mss-response
Mss response [MAILPOET-1035]
2017-07-31 14:37:13 -04:00
440052cf2c Remove duplicate code
[MAILPOET-1035]
2017-07-31 16:51:11 +02:00
ccb751b44a Adhere to updated MSS /me response
[MAILPOET-1035]
2017-07-31 16:47:20 +02:00
7cf3d0960d Unify API response constants
[MAILPOET-1035]
2017-07-31 13:51:23 +02:00
6e45856622 Merge pull request #1022 from mailpoet/mediumint_to_int
Switch ID fields from mediumint to int in DB [MAILPOET-1022]
2017-07-31 11:03:16 +02:00
9859df98b7 translate the DB error message 2017-07-31 08:53:30 +00:00
1071688924 Update a poll [MAILPOET-1017] 2017-07-31 09:41:45 +02:00
4f3b0234a4 Move exception rule to top
[MAILPOET-1028]
2017-07-31 09:27:26 +02:00
3e2bbeac11 Fix ES6 comma-dangle eslint rule (functions should be ignored pre-ES2017) [MAILPOET-1028] 2017-07-31 09:27:26 +02:00
08f81bd816 Fix ES5 comma-dangle eslint rule [MAILPOET-1028] 2017-07-31 09:27:26 +02:00
f0c59ff635 Fix tests comma-dangle eslint rule [MAILPOET-1028] 2017-07-31 09:27:26 +02:00
66c6f52646 Fix ES6 comma-spacing eslint rule [MAILPOET-1028] 2017-07-31 09:27:26 +02:00
4988aaf14f Fix ES5 comma-spacing eslint rule [MAILPOET-1028] 2017-07-31 09:27:26 +02:00
5773d46f1c Merge pull request #1029 from mailpoet/alc-rendering
Enable blockquotes and fix image positioning in ALC blocks [MAILPOET-1037] [MAILPOET-1038]
2017-07-30 12:01:39 -04:00
f3a1e1b447 Update Robo test debug rule to accept individual test file paths 2017-07-28 14:36:40 +03:00
6de746162e Update Posts transformer to extract images by splitting the DOM tree 2017-07-28 14:36:12 +03:00
60b3c066a5 Allow rendering blockquote tags 2017-07-28 11:10:57 +03:00
63158dc2d5 Merge pull request #1024 from mailpoet/mta-frequency-fix
Mta frequency fix [MAILPOET-1021]
2017-07-27 19:17:14 +03:00
dede6e56c4 Merge pull request #1026 from mailpoet/beta_end
Remove concept of "Beta" on readme.txt, update banners [MAILPOET-1023]
2017-07-27 15:49:22 +03:00
dd366dde18 Remove concept of "Beta" on readme.txt, update banners [MAILPOET-1023] 2017-07-27 14:04:00 +03:00
2fedafe483 Merge pull request #1025 from mailpoet/tests_sniffs
Enable remaining CodeSniffer rules for PHP tests [MAILPOET-1025]
2017-07-26 21:34:48 -04:00
feae98ac3f Use a single ruleset for both the plugin and its tests [MAILPOET-1025] 2017-07-26 18:56:14 +03:00
6fb18ad321 Fix PSR1.Classes.ClassDeclaration sniffer rule in tests [MAILPOET-1025] 2017-07-26 18:28:56 +03:00
6c843e35b0 Update warning text
[MAILPOET-1021]
2017-07-26 16:27:53 +02:00
cfdb86eb6e Replace default option text
[MAILPOET-1021]
2017-07-26 16:24:31 +02:00
41fb93e453 Remove the number of emails per day calculation
[MAILPOET-1021]
2017-07-26 16:22:23 +02:00
19813b5dad Fix host frequency override
[MAILPOET-1021]
2017-07-26 16:08:49 +02:00
321393f119 Fix Squiz.Classes.ClassFileName sniffer rule in tests [MAIPOET-1025] 2017-07-26 17:03:43 +03:00
ab3f41302c Merge pull request #1023 from mailpoet/remove-subquery
Use Joins instead subqueries [MAILPOET-1027]
2017-07-26 13:56:32 +03:00
9dff4539e6 Use Joins instead subqueries
[MAILPOET-1027]
2017-07-26 11:46:36 +02:00
6520d5eca3 Merge branch 'master' of github.com:mailpoet/mailpoet 2017-07-25 16:45:42 +03:00
1d2cab1249 Merge pull request #1021 from mailpoet/prevent-mss-override
Prevent to override sending group [MAILPOET-1024]
2017-07-25 15:24:28 +03:00
563ca3e605 Switch ID fields from mediumint to int in DB [MAILPOET-1022] 2017-07-25 13:11:56 +03:00
5572a7f1e5 Prevent to override sending group
[MAILPOET-1024]
2017-07-25 08:32:10 +02:00
252 changed files with 1976 additions and 1812 deletions

View File

@ -14,7 +14,6 @@
"comma-dangle": 0,
"space-before-function-paren": 0,
"prefer-arrow-callback": 0,
"no-undef": 0,
@ -44,7 +43,6 @@
"no-empty": 0,
"no-extra-semi": 0,
"no-useless-escape": 0,
"comma-spacing": 0,
"wrap-iife": 0,
"no-unused-expressions": 0,
"block-spacing": 0,

View File

@ -11,9 +11,12 @@
}
},
"rules": {
"import/no-amd": 0,
"comma-dangle": ["error", "always-multiline"],
"import/no-amd": 0,
"react/no-multi-comp": 0,
"react/sort-comp": 0,
"react/jsx-max-props-per-line": 0,
@ -39,7 +42,6 @@
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/alt-text": 0,
"comma-dangle": 0,
"func-names": 0,
"object-shorthand": 0,
"no-bitwise": 0,
@ -73,7 +75,6 @@
"newline-per-chained-call": 0,
"no-else-return": 0,
"max-len": 0,
"comma-spacing": 0,
"no-useless-concat": 0,
"no-unused-expressions": 0,
"no-sequences": 0,

View File

@ -35,7 +35,6 @@
"quote-props": 0,
"no-shadow": 0,
"padded-blocks": 0,
"comma-dangle": 0,
"vars-on-top": 0,
"space-before-blocks": 0,
"object-curly-spacing": 0,

View File

@ -199,10 +199,16 @@ class RoboFile extends \Robo\Tasks {
return $this->_exec($command);
}
function testDebug() {
$this->_exec('vendor/bin/codecept build');
function testDebug($opts=['file' => null, 'xml' => false]) {
$this->loadEnv();
return $this->_exec('vendor/bin/codecept run unit --debug');
$this->_exec('vendor/bin/codecept build');
$command = 'vendor/bin/codecept run unit --debug -f '.(($opts['file']) ? $opts['file'] : '');
if($opts['xml']) {
$command .= ' --xml';
}
return $this->_exec($command);
}
function testFailed() {
@ -239,6 +245,7 @@ class RoboFile extends \Robo\Tasks {
->taskExec(
'./vendor/bin/phpcs '.
'--standard=./tasks/code_sniffer/MailPoet '.
'--runtime-set testVersion 5.3-7.0 '.
'--ignore=./lib/Util/Sudzy/*,./lib/Util/CSS.php,./lib/Util/XLSXWriter.php,'.
'./lib/Util/pQuery/*,./lib/Config/PopulatorData/Templates/* '.
'lib/ '.
@ -246,7 +253,8 @@ class RoboFile extends \Robo\Tasks {
)
->taskExec(
'./vendor/bin/phpcs '.
'--standard=./tasks/code_sniffer/MailPoetTests '.
'--standard=./tasks/code_sniffer/MailPoet '.
'--runtime-set testVersion 5.4-7.0 '.
'--ignore=./tests/unit/_bootstrap.php '.
'tests/unit/ '.
$severityFlag
@ -284,8 +292,9 @@ class RoboFile extends \Robo\Tasks {
$plugin_data = get_plugin_data('mailpoet.php', false, false);
$plugin_version = $plugin_data['Version'];
$plugin_dist_name = sanitize_title_with_dashes($plugin_data['Name']);
$plugin_dist_name = explode('-', $plugin_dist_name);
$plugin_dist_name = $plugin_dist_name[0];
$plugin_dist_file = $plugin_dist_name . '.zip';
$this->say('Publishing version: ' . $plugin_version);
// Sanity checks
@ -413,4 +422,4 @@ class RoboFile extends \Robo\Tasks {
require_once(ABSPATH . WPINC . '/plugin.php');
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
}
}

View File

@ -26,10 +26,6 @@ $block-text-line-height = $text-line-height
&.mailpoet_highlight > .mailpoet_block_highlight
border: 1px dashed $block-hover-highlight-color
.mailpoet_block:last-child
margin-bottom: 0
.mailpoet_content
position: relative
line-height: $block-text-line-height

View File

@ -55,7 +55,7 @@ function cacheEvent(forced, name, data) {
eventsCache.push({
name: name,
data: data,
forced: forced,
forced: forced
});
}

View File

@ -1,5 +1,5 @@
define([
'react'
'react',
],
(
React
@ -42,7 +42,7 @@ define([
{ options }
</div>
);
}
},
});
return FormFieldCheckbox;

View File

@ -104,7 +104,7 @@ define([
this.state = {
year: '',
month: '',
day: ''
day: '',
};
}
componentDidMount() {
@ -132,7 +132,7 @@ define([
this.setState({
year: dateTime.format('YYYY'),
month: dateTime.format('M'),
day: dateTime.format('D')
day: dateTime.format('D'),
});
}
formatValue() {
@ -145,26 +145,26 @@ define([
value = {
'year': this.state.year,
'month': this.state.month,
'day': this.state.day
'day': this.state.day,
};
break;
case 'year_month':
value = {
'year': this.state.year,
'month': this.state.month
'month': this.state.month,
};
break;
case 'month':
value = {
'month': this.state.month
'month': this.state.month,
};
break;
case 'year':
value = {
'year': this.state.year
'year': this.state.year,
};
break;
}
@ -184,13 +184,13 @@ define([
const value = ~~(e.target.value);
this.setState({
[`${property}`]: value
[`${property}`]: value,
}, () => {
this.props.onValueChange({
target: {
name: field,
value: this.formatValue()
}
value: this.formatValue(),
},
});
});
}

View File

@ -92,7 +92,7 @@ define([
index: index,
field: subfield,
item: this.props.item,
onValueChange: this.props.onValueChange || false
onValueChange: this.props.onValueChange || false,
});
});
} else {
@ -121,7 +121,7 @@ define([
</td>
</tr>
);
}
},
});
return FormField;

View File

@ -1,5 +1,5 @@
define([
'react'
'react',
],
(
React
@ -34,7 +34,7 @@ define([
{ options }
</div>
);
}
},
});
return FormFieldRadio;

View File

@ -70,7 +70,7 @@ const FormFieldSelect = React.createClass({
{options}
</select>
);
}
},
});
module.exports = FormFieldSelect;

View File

@ -2,7 +2,7 @@ define([
'react',
'react-dom',
'jquery',
'select2'
'select2',
],
(
React,
@ -13,7 +13,7 @@ define([
getInitialState: function () {
return {
items: [],
select2: false
select2: false,
};
},
componentWillMount: function () {
@ -67,7 +67,7 @@ define([
return item.text;
}
}
}
},
});
let hasRemoved = false;
@ -111,7 +111,7 @@ define([
}
this.setState({
items: items
items: items,
});
}
},
@ -126,8 +126,8 @@ define([
this.props.onValueChange({
target: {
value: transformedValue,
name: this.props.field.name
}
name: this.props.field.name,
},
});
}
},
@ -186,7 +186,7 @@ define([
{...this.props.field.validation}
>{ options }</select>
);
}
},
});
return Selection;

View File

@ -29,7 +29,7 @@ const FormFieldText = React.createClass({
{...this.props.field.validation}
/>
);
}
},
});
module.exports = FormFieldText;

View File

@ -1,5 +1,5 @@
define([
'react'
'react',
],
(
React
@ -19,7 +19,7 @@ define([
{...this.props.field.validation}
/>
);
}
},
});
return FormFieldTextarea;

View File

@ -4,7 +4,7 @@ define(
'mailpoet',
'classnames',
'react-router',
'form/fields/field.jsx'
'form/fields/field.jsx',
],
(
React,
@ -16,7 +16,7 @@ define(
const Form = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
router: React.PropTypes.object.isRequired,
},
getDefaultProps: function () {
return {
@ -27,7 +27,7 @@ define(
return {
loading: false,
errors: [],
item: {}
item: {},
};
},
getValues: function () {
@ -42,7 +42,7 @@ define(
this.loadItem(this.props.params.id);
} else {
this.setState({
item: jQuery('.mailpoet_form').serializeObject()
item: jQuery('.mailpoet_form').serializeObject(),
});
}
}
@ -51,7 +51,7 @@ define(
if(props.params.id === undefined) {
this.setState({
loading: false,
item: {}
item: {},
});
if (props.item === undefined) {
this.refs.form.reset();
@ -68,17 +68,17 @@ define(
endpoint: this.props.endpoint,
action: 'get',
data: {
id: id
}
id: id,
},
}).done((response) => {
this.setState({
loading: false,
item: response.data
item: response.data,
});
}).fail(() => {
this.setState({
loading: false,
item: {}
item: {},
}, function () {
this.context.router.push('/new');
});
@ -116,7 +116,7 @@ define(
api_version: window.mailpoet_api_version,
endpoint: this.props.endpoint,
action: 'save',
data: item
data: item,
}).always(() => {
this.setState({ loading: false });
}).done(() => {
@ -147,7 +147,7 @@ define(
item[field] = e.target.value;
this.setState({
item: item
item: item,
});
return true;
}
@ -238,7 +238,7 @@ define(
{ afterFormContent }
</div>
);
}
},
});
return Form;

View File

@ -9,7 +9,7 @@ const history = useRouterHistory(createHashHistory)({ queryKey: false });
const App = React.createClass({
render() {
return this.props.children;
}
},
});
const container = document.getElementById('forms_container');

View File

@ -7,21 +7,21 @@ const columns = [
{
name: 'name',
label: MailPoet.I18n.t('formName'),
sortable: true
sortable: true,
},
{
name: 'segments',
label: MailPoet.I18n.t('segments')
label: MailPoet.I18n.t('segments'),
},
{
name: 'signups',
label: MailPoet.I18n.t('signups')
label: MailPoet.I18n.t('signups'),
},
{
name: 'created_at',
label: MailPoet.I18n.t('createdOn'),
sortable: true
}
sortable: true,
},
];
const messages = {
@ -69,15 +69,15 @@ const messages = {
).replace('%$1d', count.toLocaleString());
}
MailPoet.Notice.success(message);
}
},
};
const bulk_actions = [
{
name: 'trash',
label: MailPoet.I18n.t('moveToTrash'),
onSuccess: messages.onTrash
}
onSuccess: messages.onTrash,
},
];
const item_actions = [
@ -88,7 +88,7 @@ const item_actions = [
return (
<a href={ `admin.php?page=mailpoet-form-editor&id=${item.id}` }>{MailPoet.I18n.t('edit')}</a>
);
}
},
},
{
name: 'duplicate',
@ -99,8 +99,8 @@ const item_actions = [
endpoint: 'forms',
action: 'duplicate',
data: {
id: item.id
}
id: item.id,
},
}).done((response) => {
MailPoet.Notice.success(
(MailPoet.I18n.t('formDuplicated')).replace('%$1s', response.data.name)
@ -114,11 +114,11 @@ const item_actions = [
);
}
});
}
},
},
{
name: 'trash'
}
name: 'trash',
},
];
const FormList = React.createClass({
@ -126,7 +126,7 @@ const FormList = React.createClass({
MailPoet.Ajax.post({
api_version: window.mailpoet_api_version,
endpoint: 'forms',
action: 'create'
action: 'create',
}).done((response) => {
window.location = mailpoet_form_edit_url + response.data.id;
}).fail((response) => {
@ -203,7 +203,7 @@ const FormList = React.createClass({
/>
</div>
);
}
},
});
module.exports = FormList;

View File

@ -11,7 +11,7 @@ const history = useRouterHistory(createHashHistory)({ queryKey: false });
const App = React.createClass({
render() {
return this.props.children;
}
},
});
const container = document.getElementById('help_container');

View File

@ -7,12 +7,12 @@ const tabs = [
{
name: 'knowledgeBase',
label: MailPoet.I18n.t('tabKnowledgeBaseTitle'),
link: '/knowledgeBase'
link: '/knowledgeBase',
},
{
name: 'systemInfo',
label: MailPoet.I18n.t('tabSystemInfoTitle'),
link: '/systemInfo'
link: '/systemInfo',
},
];

View File

@ -1,3 +1,3 @@
define([], function() {
!function(e,o,n){window.HSCW=o,window.HS=n,n.beacon=n.beacon||{};var t=n.beacon;t.userConfig={},t.readyQueue=[],t.config=function(e){this.userConfig=e},t.ready=function(e){this.readyQueue.push(e)},o.config={docs:{enabled:!0,baseUrl:"//mailpoet3.helpscoutdocs.com/"},contact:{enabled:!0,formId:"aa21ca80-a4f5-11e6-91aa-0a5fecc78a4d"}};var r=e.getElementsByTagName("script")[0],c=e.createElement("script");c.type="text/javascript",c.async=!0,c.src="https://djtflbt20bdde.cloudfront.net/",r.parentNode.insertBefore(c,r)}(document,window.HSCW||{},window.HS||{});
!function(e, o, n){window.HSCW=o, window.HS=n, n.beacon=n.beacon||{};var t=n.beacon;t.userConfig={}, t.readyQueue=[], t.config=function(e){this.userConfig=e}, t.ready=function(e){this.readyQueue.push(e)}, o.config={docs:{enabled:!0, baseUrl:"//mailpoet3.helpscoutdocs.com/"}, contact:{enabled:!0, formId:"aa21ca80-a4f5-11e6-91aa-0a5fecc78a4d"}};var r=e.getElementsByTagName("script")[0], c=e.createElement("script");c.type="text/javascript", c.async=!0, c.src="https://djtflbt20bdde.cloudfront.net/", r.parentNode.insertBefore(c, r)}(document, window.HSCW||{}, window.HS||{});
});

View File

@ -27,7 +27,7 @@ define(
coerce_types = { 'true': !0, 'false': !1, 'null': null };
// Iterate over all name=value pairs.
$.each( this.serializeArray(), function(j,v){
$.each( this.serializeArray(), function(j, v){
var key = v.name,
val = v.value,
cur = obj,

View File

@ -1,6 +1,6 @@
define([
'react',
'mailpoet'
'mailpoet',
],
(
React,
@ -10,20 +10,20 @@ define([
getInitialState: function () {
return {
action: false,
extra: false
extra: false,
};
},
handleChangeAction: function (e) {
this.setState({
action: e.target.value,
extra: false
extra: false,
}, () => {
const action = this.getSelectedAction();
// action on select callback
if(action !== null && action['onSelect'] !== undefined) {
this.setState({
extra: action.onSelect(e)
extra: action.onSelect(e),
});
}
});
@ -61,7 +61,7 @@ define([
this.setState({
action: false,
extra: false
extra: false,
});
},
getSelectedAction: function () {
@ -115,7 +115,7 @@ define([
{ this.state.extra }
</div>
);
}
},
});
return ListingBulkActions;

View File

@ -1,7 +1,7 @@
define([
'react',
'jquery',
'mailpoet'
'mailpoet',
],
(
React,
@ -100,7 +100,7 @@ define([
{ empty_trash }
</div>
);
}
},
});
return ListingFilters;

View File

@ -32,7 +32,7 @@ define(['react', 'classnames'], (React, classNames) => {
{ groups }
</ul>
);
}
},
});
return ListingGroups;

View File

@ -48,7 +48,7 @@ const ListingHeader = React.createClass({
{columns}
</tr>
);
}
},
});
const ListingColumn = React.createClass({
@ -85,7 +85,7 @@ const ListingColumn = React.createClass({
width={ this.props.column.width || null }
>{label}</th>
);
}
},
});
module.exports = ListingHeader;

View File

@ -14,7 +14,7 @@ import ListingFilters from 'listing/filters.jsx';
const ListingItem = React.createClass({
getInitialState: function () {
return {
expanded: false
expanded: false,
};
},
handleSelectItem: function (e) {
@ -191,7 +191,7 @@ const ListingItem = React.createClass({
{ this.props.onRenderItem(this.props.item, actions) }
</tr>
);
}
},
});
@ -229,7 +229,7 @@ const ListingItems = React.createClass({
{ 'mailpoet_hidden': (
this.props.selection === false
|| (this.props.count <= this.props.limit)
)
),
}
);
@ -283,12 +283,12 @@ const ListingItems = React.createClass({
</tbody>
);
}
}
},
});
const Listing = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
router: React.PropTypes.object.isRequired,
},
getInitialState: function () {
return {
@ -306,7 +306,7 @@ const Listing = React.createClass({
filter: {},
selected_ids: [],
selection: false,
meta: {}
meta: {},
};
},
getParam: function (param) {
@ -378,7 +378,7 @@ const Listing = React.createClass({
'search',
'page',
'sort_by',
'sort_order'
'sort_order',
].indexOf(key) !== -1
);
})
@ -463,8 +463,8 @@ const Listing = React.createClass({
filter: this.state.filter,
search: this.state.search,
sort_by: this.state.sort_by,
sort_order: this.state.sort_order
}
sort_order: this.state.sort_order,
},
}).always(() => {
this.setState({ loading: false });
}).done((response) => {
@ -473,7 +473,7 @@ const Listing = React.createClass({
filters: response.meta.filters || {},
groups: response.meta.groups || [],
count: response.meta.count || 0,
meta: _.omit(response.meta, ['filters', 'groups', 'count'])
meta: _.omit(response.meta, ['filters', 'groups', 'count']),
}, () => {
// if viewing an empty trash
if (this.state.group === 'trash' && response.meta.count === 0) {
@ -499,7 +499,7 @@ const Listing = React.createClass({
handleRestoreItem: function (id) {
this.setState({
loading: true,
page: 1
page: 1,
});
MailPoet.Ajax.post({
@ -507,8 +507,8 @@ const Listing = React.createClass({
endpoint: this.props.endpoint,
action: 'restore',
data: {
id: id
}
id: id,
},
}).done((response) => {
if (
this.props.messages !== undefined
@ -527,7 +527,7 @@ const Listing = React.createClass({
handleTrashItem: function (id) {
this.setState({
loading: true,
page: 1
page: 1,
});
MailPoet.Ajax.post({
@ -535,8 +535,8 @@ const Listing = React.createClass({
endpoint: this.props.endpoint,
action: 'trash',
data: {
id: id
}
id: id,
},
}).done((response) => {
if (
this.props.messages !== undefined
@ -555,7 +555,7 @@ const Listing = React.createClass({
handleDeleteItem: function (id) {
this.setState({
loading: true,
page: 1
page: 1,
});
MailPoet.Ajax.post({
@ -563,8 +563,8 @@ const Listing = React.createClass({
endpoint: this.props.endpoint,
action: 'delete',
data: {
id: id
}
id: id,
},
}).done((response) => {
if (
this.props.messages !== undefined
@ -583,7 +583,7 @@ const Listing = React.createClass({
handleEmptyTrash: function () {
return this.handleBulkAction('all', {
action: 'delete',
group: 'trash'
group: 'trash',
}).done((response) => {
MailPoet.Notice.success(
MailPoet.I18n.t('permanentlyDeleted').replace('%d', response.meta.count)
@ -615,7 +615,7 @@ const Listing = React.createClass({
limit: 0,
filter: this.state.filter,
group: this.state.group,
search: this.state.search
search: this.state.search,
};
if (selected_ids !== 'all') {
data.listing.selection = selected_ids;
@ -625,7 +625,7 @@ const Listing = React.createClass({
api_version: window.mailpoet_api_version,
endpoint: this.props.endpoint,
action: 'bulkAction',
data: data
data: data,
}).done(() => {
this.getItems();
}).fail((response) => {
@ -642,7 +642,7 @@ const Listing = React.createClass({
search: search,
page: 1,
selection: false,
selected_ids: []
selected_ids: [],
}, () => {
this.setParams();
});
@ -673,7 +673,7 @@ const Listing = React.createClass({
this.setState({
selection: selection,
selected_ids: selected_ids
selected_ids: selected_ids,
});
},
handleSelectItems: function (is_checked) {
@ -686,7 +686,7 @@ const Listing = React.createClass({
this.setState({
selected_ids: selected_ids,
selection: 'page'
selection: 'page',
});
}
},
@ -696,20 +696,20 @@ const Listing = React.createClass({
} else {
this.setState({
selection: 'all',
selected_ids: []
selected_ids: [],
});
}
},
clearSelection: function () {
this.setState({
selection: false,
selected_ids: []
selected_ids: [],
});
},
handleFilter: function (filters) {
this.setState({
filter: filters,
page: 1
page: 1,
}, () => {
this.setParams();
});
@ -722,7 +722,7 @@ const Listing = React.createClass({
group: group,
filter: {},
search: '',
page: 1
page: 1,
}, () => {
this.setParams();
});
@ -731,7 +731,7 @@ const Listing = React.createClass({
this.setState({
page: page,
selection: false,
selected_ids: []
selected_ids: [],
}, () => {
this.setParams();
});
@ -762,13 +762,13 @@ const Listing = React.createClass({
{
name: 'restore',
label: MailPoet.I18n.t('restore'),
onSuccess: this.props.messages.onRestore
onSuccess: this.props.messages.onRestore,
},
{
name: 'delete',
label: MailPoet.I18n.t('deletePermanently'),
onSuccess: this.props.messages.onDelete
}
onSuccess: this.props.messages.onDelete,
},
];
}
@ -897,7 +897,7 @@ const Listing = React.createClass({
</div>
</div>
);
}
},
});
module.exports = Listing;

View File

@ -1,7 +1,7 @@
define([
'react',
'classnames',
'mailpoet'
'mailpoet',
], (
React,
classNames,
@ -11,12 +11,12 @@ define([
const ListingPages = React.createClass({
getInitialState: function () {
return {
page: null
page: null,
};
},
setPage: function (page) {
this.setState({
page: null
page: null,
}, () => {
this.props.onSetPage(this.constrainPage(page));
});
@ -47,7 +47,7 @@ define([
},
handleChangeManualPage: function (e) {
this.setState({
page: e.target.value
page: e.target.value,
});
},
handleBlurManualPage: function (e) {
@ -178,7 +178,7 @@ define([
</div>
);
}
}
},
});
return ListingPages;

View File

@ -1,6 +1,6 @@
define([
'mailpoet',
'react'
'react',
], (
MailPoet,
React
@ -40,7 +40,7 @@ define([
</form>
);
}
}
},
});
return ListingSearch;

View File

@ -15,8 +15,8 @@ define([
contentRegion: '#mailpoet_editor_content',
sidebarRegion: '#mailpoet_editor_sidebar',
bottomRegion: '#mailpoet_editor_bottom',
headingRegion: '#mailpoet_editor_heading',
},
headingRegion: '#mailpoet_editor_heading'
}
});
var EditorApplication = Marionette.Application.extend({

View File

@ -21,6 +21,6 @@ define([
chooseText: MailPoet.I18n.t('selectColor'),
cancelText: MailPoet.I18n.t('cancelColorSelection')
});
},
}
});
});

View File

@ -15,7 +15,7 @@ define([
BehaviorsLookup.ContainerDropZoneBehavior = Marionette.Behavior.extend({
defaults: {
columnLimit: 3,
columnLimit: 3
},
onRender: function() {
var dragAndDropDisabled = _.isObject(this.view.options.renderOptions) && this.view.options.renderOptions.disableDragAndDrop === true;
@ -195,7 +195,7 @@ define([
if (view.model.get('orientation') === 'horizontal' && droppableModel.get('type') !== 'container') {
// Regular blocks always need to be inserted into columns - vertical containers
tempCollection = new (EditorApplication.getBlockTypeModel('container'))({
orientation: 'vertical',
orientation: 'vertical'
});
tempCollection.get('blocks').add(droppableModel);
viewCollection.add(tempCollection, {at: index});
@ -210,7 +210,7 @@ define([
var tempModel = viewCollection.at(dropPosition.index);
tempCollection = new (EditorApplication.getBlockTypeModel('container'))({
orientation: (view.model.get('orientation') === 'vertical') ? 'horizontal' : 'vertical',
orientation: (view.model.get('orientation') === 'vertical') ? 'horizontal' : 'vertical'
});
viewCollection.remove(tempModel);
@ -218,19 +218,19 @@ define([
if (tempCollection.get('orientation') === 'horizontal') {
if (dropPosition.position === 'before') {
tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({
orientation: 'vertical',
orientation: 'vertical'
});
tempCollection2.get('blocks').add(droppableModel);
tempCollection.get('blocks').add(tempCollection2);
}
tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({
orientation: 'vertical',
orientation: 'vertical'
});
tempCollection2.get('blocks').add(tempModel);
tempCollection.get('blocks').add(tempCollection2);
if (dropPosition.position === 'after') {
tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({
orientation: 'vertical',
orientation: 'vertical'
});
tempCollection2.get('blocks').add(droppableModel);
tempCollection.get('blocks').add(tempCollection2);
@ -254,11 +254,11 @@ define([
event.draggable.onDrop({
dropBehavior: that,
droppedModel: droppableModel,
droppedView: droppedView,
droppedView: droppedView
});
that.cleanup();
},
}
});
},
cleanup: function() {
@ -296,7 +296,7 @@ define([
return {
insertionType: 'normal',
index: 0,
position: 'inside',
position: 'inside'
};
}
@ -347,7 +347,7 @@ define([
return {
insertionType: insertionType, // 'normal'|'special'
index: index,
position: position, // 'inside'|'before'|'after'
position: position // 'inside'|'before'|'after'
};
},
_computeNormalIndex: function(eventX, eventY) {
@ -377,13 +377,13 @@ define([
// First half of the element
return {
index: index,
position: 'before',
position: 'before'
};
} else {
// Second half of the element
return {
index: index,
position: 'after',
position: 'after'
};
}
},

View File

@ -28,7 +28,7 @@ define([
},
onDrop: function(model, view) {},
testAttachToInstance: function(model, view) { return true; },
testAttachToInstance: function(model, view) { return true; }
},
onRender: function() {
var that = this,
@ -38,7 +38,7 @@ define([
if (!this.options.testAttachToInstance(this.view.model, this.view)) return;
interactable = interact(this.$el.get(0), {
ignoreFrom: this.options.ignoreSelector,
ignoreFrom: this.options.ignoreSelector
}).draggable({
// allow dragging of multple elements at the same time
max: Infinity,
@ -111,7 +111,7 @@ define([
that.view.$el.removeClass('mailpoet_hidden');
}
}
},
}
})
.preventDefault('auto')
.styleCursor(false)
@ -137,6 +137,6 @@ define([
// Delegate to view's event handler
that.options.onDrop.apply(that, [options]);
};
},
}
});
});

View File

@ -5,19 +5,19 @@
*/
define([
'backbone.marionette',
'newsletter_editor/behaviors/BehaviorsLookup',
'newsletter_editor/behaviors/BehaviorsLookup'
], function(Marionette, BehaviorsLookup) {
BehaviorsLookup.HighlightEditingBehavior = Marionette.Behavior.extend({
modelEvents: {
'startEditing': 'enableHighlight',
'stopEditing': 'disableHighlight',
'stopEditing': 'disableHighlight'
},
enableHighlight: function() {
this.$el.addClass('mailpoet_highlight');
},
disableHighlight: function() {
this.$el.removeClass('mailpoet_highlight');
},
}
});
});

View File

@ -15,11 +15,11 @@ define([
resizeHandleSelector: true, // true will use edges of the element itself
transformationFunction: function(y) { return y; },
minLength: 0,
modelField: 'styles.block.height',
modelField: 'styles.block.height'
},
events: {
"mouseenter": 'showResizeHandle',
"mouseleave": 'hideResizeHandle',
"mouseleave": 'hideResizeHandle'
},
onRender: function() {
this.attachResize();
@ -37,8 +37,8 @@ define([
top: false,
left: false,
right: false,
bottom: (typeof this.options.resizeHandleSelector === 'string') ? this.view.$(this.options.resizeHandleSelector).get(0) : this.options.resizeHandleSelector,
},
bottom: (typeof this.options.resizeHandleSelector === 'string') ? this.view.$(this.options.resizeHandleSelector).get(0) : this.options.resizeHandleSelector
}
}).on('resizestart', function(event) {
that.isBeingResized = true;
that.$el.addClass('mailpoet_resize_active');
@ -63,6 +63,6 @@ define([
if (typeof this.options.resizeHandleSelector === 'string') {
this.view.$(this.options.resizeHandleSelector).addClass('mailpoet_hidden');
}
},
}
});
});

View File

@ -6,15 +6,15 @@
define([
'backbone.marionette',
'jquery',
'newsletter_editor/behaviors/BehaviorsLookup',
'newsletter_editor/behaviors/BehaviorsLookup'
], function(Marionette, jQuery, BehaviorsLookup) {
BehaviorsLookup.ShowSettingsBehavior = Marionette.Behavior.extend({
defaults: {
ignoreFrom: '', // selector
ignoreFrom: '' // selector
},
events: {
'click .mailpoet_content': 'showSettings',
'click .mailpoet_content': 'showSettings'
},
showSettings: function(event) {
if(!this.isIgnoredElement(event.target)) {
@ -25,7 +25,7 @@ define([
return this.options.ignoreFrom
&& this.options.ignoreFrom.length > 0
&& jQuery(element).is(this.options.ignoreFrom);
},
}
});
});

View File

@ -32,7 +32,7 @@ define([
collection.remove(model);
collection.add(model, { at: newIndex });
},
items: this.options.items,
items: this.options.items
});
}
}

View File

@ -18,7 +18,7 @@ define([
invalidElements: "script",
blockFormats: 'Paragraph=p',
plugins: "link textcolor colorpicker mailpoet_shortcodes",
configurationFilter: function(originalConfig) { return originalConfig; },
configurationFilter: function(originalConfig) { return originalConfig; }
},
onDomRefresh: function() {
var that = this;
@ -76,7 +76,7 @@ define([
editor.on('blur', function(e) {
that.view.triggerMethod('text:editor:blur');
});
},
}
}));
}
});

View File

@ -53,7 +53,7 @@ define([
});
CommunicationComponent.getBulkTransformedPosts({
blocks: blocks,
blocks: blocks
}).then(_.partial(this.refreshBlocks, models));
},
refreshBlocks: function(models, renderedBlocks) {
@ -65,7 +65,7 @@ define([
model.trigger('refreshPosts', contents);
}
);
},
}
});
Module.AutomatedLatestContentBlockModel = base.BlockModel.extend({
@ -97,14 +97,14 @@ define([
sortBy: 'newest', // 'newest'|'oldest',
showDivider: true, // true|false
divider: {},
_container: new (App.getBlockTypeModel('container'))(),
_container: new (App.getBlockTypeModel('container'))()
}, App.getConfig().get('blockDefaults.automatedLatestContent'));
},
relations: function() {
return {
readMoreButton: App.getBlockTypeModel('button'),
divider: App.getBlockTypeModel('divider'),
_container: App.getBlockTypeModel('container'),
_container: App.getBlockTypeModel('container')
};
},
initialize: function() {
@ -124,7 +124,7 @@ define([
*/
_scheduleFetchPosts: function() {
App.getChannel().trigger('automatedLatestContentRefresh');
},
}
});
Module.AutomatedLatestContentBlockView = base.BlockView.extend({
@ -138,15 +138,15 @@ define([
getTemplate: function() { return templates.automatedLatestContentBlock; },
regions: {
toolsRegion: '.mailpoet_tools',
postsRegion: '.mailpoet_automated_latest_content_block_posts',
postsRegion: '.mailpoet_automated_latest_content_block_posts'
},
modelEvents: _.extend(
_.omit(base.BlockView.prototype.modelEvents, 'change'),
{
'postsChanged': 'render',
'postsChanged': 'render'
}),
events: _.extend(base.BlockView.prototype.events, {
'click .mailpoet_automated_latest_content_block_overlay': 'showSettings',
'click .mailpoet_automated_latest_content_block_overlay': 'showSettings'
}),
onDragSubstituteBy: function() { return Module.AutomatedLatestContentWidgetView; },
onRender: function() {
@ -154,16 +154,16 @@ define([
renderOptions = {
disableTextEditor: true,
disableDragAndDrop: true,
emptyContainerMessage: MailPoet.I18n.t('noPostsToDisplay'),
emptyContainerMessage: MailPoet.I18n.t('noPostsToDisplay')
};
this.toolsView = new Module.AutomatedLatestContentBlockToolsView({ model: this.model });
this.showChildView('toolsRegion', this.toolsView);
this.showChildView('postsRegion', new ContainerView({ model: this.model.get('_container'), renderOptions: renderOptions }));
},
}
});
Module.AutomatedLatestContentBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.AutomatedLatestContentBlockSettingsView; },
getSettingsView: function() { return Module.AutomatedLatestContentBlockSettingsView; }
});
// Sidebar view container
@ -192,7 +192,7 @@ define([
"input .mailpoet_automated_latest_content_categories": _.partial(this.changeField, "categoriesPrecededBy"),
"input .mailpoet_automated_latest_content_read_more_text": _.partial(this.changeField, "readMoreText"),
"change .mailpoet_automated_latest_content_sort_by": _.partial(this.changeField, "sortBy"),
"click .mailpoet_done_editing": "close",
"click .mailpoet_done_editing": "close"
};
},
onRender: function() {
@ -247,8 +247,8 @@ define([
}
)
};
},
},
}
}
}).on({
'select2:select': function(event) {
var terms = that.model.get('terms');
@ -261,7 +261,7 @@ define([
terms.remove(event.params.data);
// Reset whole model in order for change events to propagate properly
that.model.set('terms', terms.toJSON());
},
}
}).trigger( 'change' );
},
toggleDisplayOptions: function(event) {
@ -282,8 +282,8 @@ define([
renderOptions: {
displayFormat: 'subpanel',
hideLink: true,
hideApplyToAll: true,
},
hideApplyToAll: true
}
})).render();
},
showDividerSettings: function(event) {
@ -292,8 +292,8 @@ define([
model: this.model.get('divider'),
renderOptions: {
displayFormat: 'subpanel',
hideApplyToAll: true,
},
hideApplyToAll: true
}
})).render();
},
changeReadMoreType: function(event) {
@ -356,11 +356,11 @@ define([
_.each(postTypes, function(type) {
select.append(jQuery('<option>', {
value: type.name,
text: type.label,
text: type.label
}));
});
select.val(selectedValue);
},
}
});
Module.AutomatedLatestContentWidgetView = base.WidgetView.extend({
@ -373,21 +373,21 @@ define([
},
onDrop: function(options) {
options.droppedView.triggerMethod('showSettings');
},
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('automatedLatestContent', {
blockModel: Module.AutomatedLatestContentBlockModel,
blockView: Module.AutomatedLatestContentBlockView,
blockView: Module.AutomatedLatestContentBlockView
});
App.registerWidget({
name: 'automatedLatestContent',
widgetView: Module.AutomatedLatestContentWidgetView,
priority: 97,
priority: 97
});
});

View File

@ -42,21 +42,21 @@ define([
},
getChildren: function() {
return [];
},
}
});
Module.BlockView = AugmentedView.extend({
regions: {
toolsRegion: '> .mailpoet_tools',
toolsRegion: '> .mailpoet_tools'
},
modelEvents: {
'change': 'render',
'delete': 'deleteBlock',
'duplicate': 'duplicateBlock',
'duplicate': 'duplicateBlock'
},
events: {
"mouseenter": "showTools",
"mouseleave": "hideTools",
"mouseleave": "hideTools"
},
behaviors: {
DraggableBehavior: {
@ -79,14 +79,14 @@ define([
WidgetView.destroy();
return node;
}
},
}
},
HighlightEditingBehavior: {},
HighlightEditingBehavior: {}
},
templateContext: function() {
return {
model: this.model.toJSON(),
viewCid: this.cid,
viewCid: this.cid
};
},
constructor: function() {
@ -162,19 +162,19 @@ define([
easing: easing,
complete: function() {
promise.resolve();
}.bind(this),
}.bind(this)
}
).velocity(
fadeDirection,
{
duration: 250,
easing: easing,
queue: false, // Do not enqueue, trigger animation in parallel
queue: false // Do not enqueue, trigger animation in parallel
}
);
return promise;
},
}
});
Module.BlockToolsView = AugmentedView.extend({
@ -184,14 +184,14 @@ define([
"click .mailpoet_delete_block_activate": "showDeletionConfirmation",
"click .mailpoet_delete_block_cancel": "hideDeletionConfirmation",
"click .mailpoet_delete_block_confirm": "deleteBlock",
"click .mailpoet_duplicate_block": "duplicateBlock",
"click .mailpoet_duplicate_block": "duplicateBlock"
},
// Markers of whether these particular tools will be used for this instance
tools: {
settings: true,
delete: true,
duplicate: true,
move: true,
move: true
},
getSettingsView: function() { return Module.BlockSettingsView; },
initialize: function(options) {
@ -209,7 +209,7 @@ define([
return {
model: this.model.toJSON(),
viewCid: this.cid,
tools: this.tools,
tools: this.tools
};
},
changeSettings: function(options) {
@ -231,13 +231,13 @@ define([
event.preventDefault();
this.model.trigger('duplicate');
return false;
},
}
});
Module.BlockSettingsView = Marionette.View.extend({
className: 'mailpoet_editor_settings',
behaviors: {
ColorPickerBehavior: {},
ColorPickerBehavior: {}
},
initialize: function(params) {
this.model.trigger('startEditing');
@ -248,7 +248,7 @@ define([
width: App.getConfig().get('sidepanelWidth'),
onCancel: function() {
this.destroy();
}.bind(this),
}.bind(this)
};
this.renderOptions = params.renderOptions || {};
if (this.renderOptions.displayFormat === 'subpanel') {
@ -290,7 +290,7 @@ define([
onBeforeDestroy: function() {
MailPoet.Modal.close();
this.model.trigger('stopEditing');
},
}
});
Module.WidgetView = Marionette.View.extend({
@ -301,7 +301,7 @@ define([
throw "Unsupported operation";
}
}
},
}
});
return Module;

View File

@ -33,11 +33,11 @@ define([
fontFamily: 'Arial',
fontSize: '16px',
fontWeight: 'normal', // 'normal'|'bold'
textAlign: 'center',
},
},
textAlign: 'center'
}
}
}, App.getConfig().get('blockDefaults.button'));
},
}
});
Module.ButtonBlockView = base.BlockView.extend({
@ -45,7 +45,7 @@ define([
getTemplate: function() { return templates.buttonBlock; },
onDragSubstituteBy: function() { return Module.ButtonWidgetView; },
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
ShowSettingsBehavior: {},
ShowSettingsBehavior: {}
}),
initialize: function() {
base.BlockView.prototype.initialize.apply(this, arguments);
@ -57,11 +57,11 @@ define([
onRender: function() {
this.toolsView = new Module.ButtonBlockToolsView({ model: this.model });
this.showChildView('toolsRegion', this.toolsView);
},
}
});
Module.ButtonBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.ButtonBlockSettingsView; },
getSettingsView: function() { return Module.ButtonBlockSettingsView; }
});
Module.ButtonBlockSettingsView = base.BlockSettingsView.extend({
@ -95,13 +95,13 @@ define([
"input .mailpoet_field_button_line_height_input": _.partial(this.updateValueAndCall, '.mailpoet_field_button_line_height', _.partial(this.changePixelField, "styles.block.lineHeight").bind(this)),
"click .mailpoet_field_button_replace_all_styles": "applyToAll",
"click .mailpoet_done_editing": "close",
"click .mailpoet_done_editing": "close"
};
},
templateContext: function() {
return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
availableStyles: App.getAvailableStyles().toJSON(),
renderOptions: this.renderOptions,
renderOptions: this.renderOptions
});
},
applyToAll: function() {
@ -127,21 +127,21 @@ define([
cloneOriginal: true,
drop: function() {
return new Module.ButtonBlockModel();
},
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('button', {
blockModel: Module.ButtonBlockModel,
blockView: Module.ButtonBlockView,
blockView: Module.ButtonBlockView
});
App.registerWidget({
name: 'button',
widgetView: Module.ButtonWidgetView,
priority: 92,
priority: 92
});
});

View File

@ -30,12 +30,12 @@ define([
// TODO: If type has no registered model, use a backup one
return new Type(block, {parse: true});
});
},
}
});
Module.ContainerBlockModel = base.BlockModel.extend({
relations: {
blocks: BlockCollection,
blocks: BlockCollection
},
defaults: function() {
return this._getDefaults({
@ -43,10 +43,10 @@ define([
orientation: 'vertical',
styles: {
block: {
backgroundColor: 'transparent',
},
backgroundColor: 'transparent'
}
},
blocks: new BlockCollection(),
blocks: new BlockCollection()
}, App.getConfig().get('blockDefaults.container'));
},
validate: function() {
@ -60,7 +60,7 @@ define([
// If container has any blocks - add them to a collection
if (response.type === 'container' && _.has(response, 'blocks')) {
response.blocks = new BlockCollection(response.blocks, {
parse: true,
parse: true
});
}
return response;
@ -71,7 +71,7 @@ define([
});
return _.flatten(models);
},
}
});
Module.ContainerBlocksView = Marionette.CollectionView.extend({
@ -100,12 +100,12 @@ define([
blocks: {
el: '> .mailpoet_container',
replaceElement: true
},
}
}),
className: 'mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block',
getTemplate: function() { return templates.containerBlock; },
events: _.extend({}, base.BlockView.prototype.events, {
"click .mailpoet_newsletter_layer_selector": "toggleEditingLayer",
"click .mailpoet_newsletter_layer_selector": "toggleEditingLayer"
}),
ui: {
tools: '> .mailpoet_tools'
@ -137,8 +137,8 @@ define([
// Attach Draggable only to layout containers and disable it
// for root and column containers.
return view.renderOptions.depth === 1;
},
},
}
}
}),
onDragSubstituteBy: function() {
// For two and three column layouts display their respective widgets,
@ -163,8 +163,8 @@ define([
delete: this.renderOptions.depth === 1,
duplicate: true,
move: this.renderOptions.depth === 1,
layerSelector: false,
},
layerSelector: false
}
});
this.showChildView('toolsRegion', this.toolsView);
this.showChildView('blocks', new Module.ContainerBlocksView({
@ -213,7 +213,7 @@ define([
enableContainerLayer();
}
event.stopPropagation();
},
}
});
Module.ContainerBlockEmptyView = Marionette.View.extend({
@ -224,13 +224,13 @@ define([
templateContext: function() {
return {
isRoot: this.renderOptions.depth === 0,
emptyContainerMessage: this.renderOptions.emptyContainerMessage || '',
emptyContainerMessage: this.renderOptions.emptyContainerMessage || ''
};
},
}
});
Module.ContainerBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.ContainerBlockSettingsView; },
getSettingsView: function() { return Module.ContainerBlockSettingsView; }
});
Module.ContainerBlockSettingsView = base.BlockSettingsView.extend({
@ -238,31 +238,31 @@ define([
events: function() {
return {
"change .mailpoet_field_container_background_color": _.partial(this.changeColorField, "styles.block.backgroundColor"),
"click .mailpoet_done_editing": "close",
"click .mailpoet_done_editing": "close"
};
},
regions: {
columnsSettingsRegion: '.mailpoet_container_columns_settings',
columnsSettingsRegion: '.mailpoet_container_columns_settings'
},
initialize: function() {
base.BlockSettingsView.prototype.initialize.apply(this, arguments);
this._columnsSettingsView = new (Module.ContainerBlockColumnsSettingsView)({
collection: this.model.get('blocks'),
collection: this.model.get('blocks')
});
},
onRender: function() {
this.showChildView('columnsSettingsRegion', this._columnsSettingsView);
},
}
});
Module.ContainerBlockColumnsSettingsView = Marionette.CollectionView.extend({
childView: function() { return Module.ContainerBlockColumnSettingsView; },
childViewOptions: function(model, index) {
return {
columnIndex: index,
columnIndex: index
};
},
}
});
Module.ContainerBlockColumnSettingsView = Marionette.View.extend({
@ -273,9 +273,9 @@ define([
templateContext: function() {
return {
model: this.model.toJSON(),
columnNumber: this.columnNumber,
columnNumber: this.columnNumber
};
},
}
});
Module.OneColumnContainerWidgetView = base.WidgetView.extend({
@ -288,12 +288,12 @@ define([
return new Module.ContainerBlockModel({
orientation: 'horizontal',
blocks: [
new Module.ContainerBlockModel(),
new Module.ContainerBlockModel()
]
});
}
}
},
}
});
Module.TwoColumnContainerWidgetView = base.WidgetView.extend({
@ -307,12 +307,12 @@ define([
orientation: 'horizontal',
blocks: [
new Module.ContainerBlockModel(),
new Module.ContainerBlockModel(),
new Module.ContainerBlockModel()
]
});
}
}
},
}
});
Module.ThreeColumnContainerWidgetView = base.WidgetView.extend({
@ -327,36 +327,36 @@ define([
blocks: [
new Module.ContainerBlockModel(),
new Module.ContainerBlockModel(),
new Module.ContainerBlockModel(),
new Module.ContainerBlockModel()
]
});
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('container', {
blockModel: Module.ContainerBlockModel,
blockView: Module.ContainerBlockView,
blockView: Module.ContainerBlockView
});
App.registerLayoutWidget({
name: 'oneColumnLayout',
priority: 100,
widgetView: Module.OneColumnContainerWidgetView,
widgetView: Module.OneColumnContainerWidgetView
});
App.registerLayoutWidget({
name: 'twoColumnLayout',
priority: 100,
widgetView: Module.TwoColumnContainerWidgetView,
widgetView: Module.TwoColumnContainerWidgetView
});
App.registerLayoutWidget({
name: 'threeColumnLayout',
priority: 100,
widgetView: Module.ThreeColumnContainerWidgetView,
widgetView: Module.ThreeColumnContainerWidgetView
});
});

View File

@ -24,11 +24,11 @@ define([
padding: '12px',
borderStyle: 'solid',
borderWidth: '1px',
borderColor: '#000000',
},
},
borderColor: '#000000'
}
}
}, App.getConfig().get('blockDefaults.divider'));
},
}
});
Module.DividerBlockView = base.BlockView.extend({
@ -41,11 +41,11 @@ define([
resizeHandleSelector: '.mailpoet_resize_handle',
transformationFunction: function(y) { return y / 2; },
minLength: 0, // TODO: Move this number to editor configuration
modelField: 'styles.block.padding',
modelField: 'styles.block.padding'
},
ShowSettingsBehavior: {
ignoreFrom: '.mailpoet_resize_handle'
},
}
}, base.BlockView.prototype.behaviors),
onDragSubstituteBy: function() { return Module.DividerWidgetView; },
initialize: function() {
@ -61,7 +61,7 @@ define([
},
templateContext: function() {
return _.extend({
totalHeight: parseInt(this.model.get('styles.block.padding'), 10)*2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px',
totalHeight: parseInt(this.model.get('styles.block.padding'), 10)*2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px'
}, base.BlockView.prototype.templateContext.apply(this));
},
onRender: function() {
@ -76,11 +76,11 @@ define([
this.$('.mailpoet_content').css('padding-top', this.model.get('styles.block.padding'));
this.$('.mailpoet_content').css('padding-bottom', this.model.get('styles.block.padding'));
this.$('.mailpoet_resize_handle_text').text(parseInt(this.model.get('styles.block.padding'), 10)*2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px');
},
}
});
Module.DividerBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.DividerBlockSettingsView; },
getSettingsView: function() { return Module.DividerBlockSettingsView; }
});
Module.DividerBlockSettingsView = base.BlockSettingsView.extend({
@ -96,18 +96,18 @@ define([
"change .mailpoet_field_divider_border_color": _.partial(this.changeColorField, "styles.block.borderColor"),
"change .mailpoet_field_divider_background_color": _.partial(this.changeColorField, "styles.block.backgroundColor"),
"click .mailpoet_button_divider_apply_to_all": "applyToAll",
"click .mailpoet_done_editing": "close",
"click .mailpoet_done_editing": "close"
};
},
modelEvents: function() {
return {
'change:styles.block.borderColor': 'repaintDividerStyleOptions',
'change:styles.block.borderColor': 'repaintDividerStyleOptions'
};
},
templateContext: function() {
return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
availableStyles: App.getAvailableStyles().toJSON(),
renderOptions: this.renderOptions,
renderOptions: this.renderOptions
});
},
changeStyle: function(event) {
@ -125,7 +125,7 @@ define([
updateValueAndCall: function(fieldToUpdate, callable, event) {
this.$(fieldToUpdate).val(jQuery(event.target).val());
callable(event);
},
}
});
Module.DividerWidgetView = base.WidgetView.extend({
@ -135,20 +135,20 @@ define([
cloneOriginal: true,
drop: function() {
return new Module.DividerBlockModel();
},
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('divider', {
blockModel: Module.DividerBlockModel,
blockView: Module.DividerBlockView,
blockView: Module.DividerBlockView
});
App.registerWidget({
name: 'divider',
widgetView: Module.DividerWidgetView,
priority: 93,
priority: 93
});
});

View File

@ -19,38 +19,38 @@ define([
text: '<a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br /><b>Add your postal address here!</b>',
styles: {
block: {
backgroundColor: 'transparent',
backgroundColor: 'transparent'
},
text: {
fontColor: '#000000',
fontFamily: 'Arial',
fontSize: '12px',
textAlign: 'center',
textAlign: 'center'
},
link: {
fontColor: '#0000ff',
textDecoration: 'none',
},
},
textDecoration: 'none'
}
}
}, App.getConfig().get('blockDefaults.footer'));
},
}
});
Module.FooterBlockView = base.BlockView.extend({
className: "mailpoet_block mailpoet_footer_block mailpoet_droppable_block",
getTemplate: function() { return templates.footerBlock; },
modelEvents: _.extend({
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render',
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
}, _.omit(base.BlockView.prototype.modelEvents, 'change')),
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
TextEditorBehavior: {
configurationFilter: function(originalSettings) {
return _.extend({}, originalSettings, {
mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle'),
mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
});
}
},
}
}),
onDragSubstituteBy: function() { return Module.FooterWidgetView; },
onRender: function() {
@ -67,11 +67,11 @@ define([
onTextEditorBlur: function() {
this.enableDragging();
this.enableShowingTools();
},
}
});
Module.FooterBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.FooterBlockSettingsView; },
getSettingsView: function() { return Module.FooterBlockSettingsView; }
});
Module.FooterBlockSettingsView = base.BlockSettingsView.extend({
@ -87,14 +87,14 @@ define([
},
"change .mailpoet_field_footer_background_color": _.partial(this.changeColorField, "styles.block.backgroundColor"),
"change .mailpoet_field_footer_alignment": _.partial(this.changeField, "styles.text.textAlign"),
"click .mailpoet_done_editing": "close",
"click .mailpoet_done_editing": "close"
};
},
templateContext: function() {
return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
availableStyles: App.getAvailableStyles().toJSON(),
availableStyles: App.getAvailableStyles().toJSON()
});
},
}
});
Module.FooterWidgetView = base.WidgetView.extend({
@ -104,21 +104,21 @@ define([
cloneOriginal: true,
drop: function() {
return new Module.FooterBlockModel();
},
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('footer', {
blockModel: Module.FooterBlockModel,
blockView: Module.FooterBlockView,
blockView: Module.FooterBlockView
});
App.registerWidget({
name: 'footer',
widgetView: Module.FooterWidgetView,
priority: 99,
priority: 99
});
});

View File

@ -19,38 +19,38 @@ define([
text: 'Display problems? <a href="[link:newsletter_view_in_browser_url]">View it in your browser</a>',
styles: {
block: {
backgroundColor: 'transparent',
backgroundColor: 'transparent'
},
text: {
fontColor: '#000000',
fontFamily: 'Arial',
fontSize: '12px',
textAlign: 'center',
textAlign: 'center'
},
link: {
fontColor: '#0000ff',
textDecoration: 'underline',
},
},
textDecoration: 'underline'
}
}
}, App.getConfig().get('blockDefaults.header'));
},
}
});
Module.HeaderBlockView = base.BlockView.extend({
className: "mailpoet_block mailpoet_header_block mailpoet_droppable_block",
getTemplate: function() { return templates.headerBlock; },
modelEvents: _.extend({
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render',
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
}, _.omit(base.BlockView.prototype.modelEvents, 'change')),
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
TextEditorBehavior: {
configurationFilter: function(originalSettings) {
return _.extend({}, originalSettings, {
mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle'),
mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
});
}
},
}
}),
onDragSubstituteBy: function() { return Module.HeaderWidgetView; },
onRender: function() {
@ -67,11 +67,11 @@ define([
onTextEditorBlur: function() {
this.enableDragging();
this.enableShowingTools();
},
}
});
Module.HeaderBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.HeaderBlockSettingsView; },
getSettingsView: function() { return Module.HeaderBlockSettingsView; }
});
Module.HeaderBlockSettingsView = base.BlockSettingsView.extend({
@ -87,14 +87,14 @@ define([
},
"change .mailpoet_field_header_background_color": _.partial(this.changeColorField, "styles.block.backgroundColor"),
"change .mailpoet_field_header_alignment": _.partial(this.changeField, "styles.text.textAlign"),
"click .mailpoet_done_editing": "close",
"click .mailpoet_done_editing": "close"
};
},
templateContext: function() {
return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
availableStyles: App.getAvailableStyles().toJSON(),
availableStyles: App.getAvailableStyles().toJSON()
});
},
}
});
Module.HeaderWidgetView = base.WidgetView.extend({
@ -104,21 +104,21 @@ define([
cloneOriginal: true,
drop: function() {
return new Module.HeaderBlockModel();
},
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('header', {
blockModel: Module.HeaderBlockModel,
blockView: Module.HeaderBlockView,
blockView: Module.HeaderBlockView
});
App.registerWidget({
name: 'header',
widgetView: Module.HeaderWidgetView,
priority: 98,
priority: 98
});
});

View File

@ -25,11 +25,11 @@ define([
height: '64px',
styles: {
block: {
textAlign: 'center',
},
},
textAlign: 'center'
}
}
}, App.getConfig().get('blockDefaults.image'));
},
}
});
Module.ImageBlockView = base.BlockView.extend({
@ -38,11 +38,11 @@ define([
onDragSubstituteBy: function() { return Module.ImageWidgetView; },
templateContext: function() {
return _.extend({
imageMissingSrc: App.getConfig().get('urls.imageMissing'),
imageMissingSrc: App.getConfig().get('urls.imageMissing')
}, base.BlockView.prototype.templateContext.apply(this));
},
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
ShowSettingsBehavior: {},
ShowSettingsBehavior: {}
}),
onRender: function() {
this.toolsView = new Module.ImageBlockToolsView({ model: this.model });
@ -53,11 +53,11 @@ define([
} else {
this.$el.removeClass('mailpoet_full_image');
}
},
}
});
Module.ImageBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.ImageBlockSettingsView; },
getSettingsView: function() { return Module.ImageBlockSettingsView; }
});
Module.ImageBlockSettingsView = base.BlockSettingsView.extend({
@ -70,7 +70,7 @@ define([
"change .mailpoet_field_image_full_width": _.partial(this.changeBoolCheckboxField, "fullWidth"),
"change .mailpoet_field_image_alignment": _.partial(this.changeField, "styles.block.textAlign"),
"click .mailpoet_field_image_select_another_image": "showMediaManager",
"click .mailpoet_done_editing": "close",
"click .mailpoet_done_editing": "close"
};
},
initialize: function(options) {
@ -141,7 +141,7 @@ define([
// Update user settings when users adjust the
// attachment display settings.
displayUserSettings: false
}),
})
]);
if(wp.media.view.settings.post.featuredImageId) {
@ -285,8 +285,8 @@ define([
},
displaySettings: false,
button: {
text: 'Select',
},
text: 'Select'
}
}),
that = this;
@ -318,7 +318,7 @@ define([
height: mainSize.height + 'px',
width: mainSize.width + 'px',
src: mainSize.url,
alt: (attachment.get('alt') !== "" && attachment.get('alt') !== undefined) ? attachment.get('alt') : attachment.get('title'),
alt: (attachment.get('alt') !== "" && attachment.get('alt') !== undefined) ? attachment.get('alt') : attachment.get('title')
});
// Rerender settings view due to changes from outside of settings view
that.render();
@ -346,7 +346,7 @@ define([
if (typeof this._mediaManager === 'object') {
this._mediaManager.remove();
}
},
}
});
ImageWidgetView = base.WidgetView.extend({
@ -359,22 +359,22 @@ define([
},
onDrop: function(options) {
options.droppedView.triggerMethod('showSettings', { showImageManager: true });
},
}
}
},
}
});
Module.ImageWidgetView = ImageWidgetView;
App.on('before:start', function(App, options) {
App.registerBlockType('image', {
blockModel: Module.ImageBlockModel,
blockView: Module.ImageBlockView,
blockView: Module.ImageBlockView
});
App.registerWidget({
name: 'image',
widgetView: Module.ImageWidgetView,
priority: 91,
priority: 91
});
});

View File

@ -76,7 +76,7 @@ define([
divider: {},
_selectedPosts: [],
_availablePosts: [],
_transformedPosts: new (App.getBlockTypeModel('container'))(),
_transformedPosts: new (App.getBlockTypeModel('container'))()
}, App.getConfig().get('blockDefaults.posts'));
},
relations: function() {
@ -85,7 +85,7 @@ define([
divider: App.getBlockTypeModel('divider'),
_selectedPosts: Backbone.Collection,
_availablePosts: Backbone.Collection,
_transformedPosts: App.getBlockTypeModel('container'),
_transformedPosts: App.getBlockTypeModel('container')
};
},
initialize: function() {
@ -172,7 +172,7 @@ define([
}).fail(function() {
MailPoet.Notice.error(MailPoet.I18n.t('failedToFetchRenderedPosts'));
});
},
}
});
Module.PostsBlockView = base.BlockView.extend({
@ -180,7 +180,7 @@ define([
getTemplate: function() { return templates.postsBlock; },
modelEvents: {}, // Forcefully disable all events
regions: _.extend({
postsRegion: '.mailpoet_posts_block_posts',
postsRegion: '.mailpoet_posts_block_posts'
}, base.BlockView.prototype.regions),
onDragSubstituteBy: function() { return Module.PostsWidgetView; },
initialize: function() {
@ -199,7 +199,7 @@ define([
renderOptions = {
disableTextEditor: true,
disableDragAndDrop: true,
emptyContainerMessage: MailPoet.I18n.t('noPostsToDisplay'),
emptyContainerMessage: MailPoet.I18n.t('noPostsToDisplay')
};
this.showChildView('postsRegion', new ContainerView({ model: this.model.get('_transformedPosts'), renderOptions: renderOptions }));
},
@ -208,27 +208,27 @@ define([
},
onBeforeDestroy: function() {
this.model.stopReplying('blockView', this.notifyAboutSelf, this);
},
}
});
Module.PostsBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.PostsBlockSettingsView; },
getSettingsView: function() { return Module.PostsBlockSettingsView; }
});
Module.PostsBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.postsBlockSettings; },
regions: {
selectionRegion: '.mailpoet_settings_posts_selection',
displayOptionsRegion: '.mailpoet_settings_posts_display_options',
displayOptionsRegion: '.mailpoet_settings_posts_display_options'
},
events: {
'click .mailpoet_settings_posts_show_display_options': 'switchToDisplayOptions',
'click .mailpoet_settings_posts_show_post_selection': 'switchToPostSelection',
'click .mailpoet_settings_posts_insert_selected': 'insertPosts',
'click .mailpoet_settings_posts_insert_selected': 'insertPosts'
},
templateContext: function() {
return {
model: this.model.toJSON(),
model: this.model.toJSON()
};
},
initialize: function() {
@ -251,7 +251,7 @@ define([
onCancel: function() {
// Self destroy the block if the user closes settings modal
that.model.destroy();
},
}
});
// Inform child views that they have been attached to document
@ -280,7 +280,7 @@ define([
this.model.trigger('insertSelectedPosts');
this.model.destroy();
this.close();
},
}
});
var PostsSelectionCollectionView = Marionette.CollectionView.extend({
@ -289,14 +289,14 @@ define([
emptyView: function() { return EmptyPostSelectionSettingsView; },
childViewOptions: function() {
return {
blockModel: this.blockModel,
blockModel: this.blockModel
};
},
initialize: function(options) {
this.blockModel = options.blockModel;
},
events: {
'scroll': 'onPostsScroll',
'scroll': 'onPostsScroll'
},
onPostsScroll: function(event) {
var $postsBox = jQuery(event.target);
@ -304,19 +304,19 @@ define([
// Load more posts if scrolled to bottom
this.blockModel.trigger('loadMorePosts');
}
},
}
});
var PostSelectionSettingsView = Marionette.View.extend({
getTemplate: function() { return templates.postSelectionPostsBlockSettings; },
regions: {
posts: '.mailpoet_post_selection_container',
posts: '.mailpoet_post_selection_container'
},
events: function() {
return {
'change .mailpoet_settings_posts_content_type': _.partial(this.changeField, 'contentType'),
'change .mailpoet_posts_post_status': _.partial(this.changeField, 'postStatus'),
'input .mailpoet_posts_search_term': _.partial(this.changeField, 'search'),
'input .mailpoet_posts_search_term': _.partial(this.changeField, 'search')
};
},
modelEvents: {
@ -392,8 +392,8 @@ define([
}
)
};
},
},
}
}
}).on({
'select2:select': function(event) {
var terms = that.model.get('terms');
@ -406,7 +406,7 @@ define([
terms.remove(event.params.data);
// Reset whole model in order for change events to propagate properly
that.model.set('terms', terms.toJSON());
},
}
}).trigger( 'change' );
},
changeField: function(field, event) {
@ -420,28 +420,28 @@ define([
_.each(postTypes, function(type) {
select.append(jQuery('<option>', {
value: type.name,
text: type.label,
text: type.label
}));
});
select.val(selectedValue);
},
}
});
var EmptyPostSelectionSettingsView = Marionette.View.extend({
getTemplate: function() { return templates.emptyPostPostsBlockSettings; },
getTemplate: function() { return templates.emptyPostPostsBlockSettings; }
});
var SinglePostSelectionSettingsView = Marionette.View.extend({
getTemplate: function() { return templates.singlePostPostsBlockSettings; },
events: function() {
return {
'change .mailpoet_select_post_checkbox': 'postSelectionChange',
'change .mailpoet_select_post_checkbox': 'postSelectionChange'
};
},
templateContext: function() {
return {
model: this.model.toJSON(),
index: this._index,
index: this._index
};
},
initialize: function(options) {
@ -455,7 +455,7 @@ define([
} else {
selectedPostsCollection.remove(this.model);
}
},
}
});
var PostsDisplayOptionsSettingsView = base.BlockSettingsView.extend({
@ -480,12 +480,12 @@ define([
"change .mailpoet_posts_show_categories": _.partial(this.changeField, "showCategories"),
"input .mailpoet_posts_categories": _.partial(this.changeField, "categoriesPrecededBy"),
"input .mailpoet_posts_read_more_text": _.partial(this.changeField, "readMoreText"),
"change .mailpoet_posts_sort_by": _.partial(this.changeField, "sortBy"),
"change .mailpoet_posts_sort_by": _.partial(this.changeField, "sortBy")
};
},
templateContext: function() {
return {
model: this.model.toJSON(),
model: this.model.toJSON()
};
},
showButtonSettings: function(event) {
@ -495,8 +495,8 @@ define([
renderOptions: {
displayFormat: 'subpanel',
hideLink: true,
hideApplyToAll: true,
},
hideApplyToAll: true
}
})).render();
},
showDividerSettings: function(event) {
@ -505,8 +505,8 @@ define([
model: this.model.get('divider'),
renderOptions: {
displayFormat: 'subpanel',
hideApplyToAll: true,
},
hideApplyToAll: true
}
})).render();
},
changeReadMoreType: function(event) {
@ -560,7 +560,7 @@ define([
this.$('.mailpoet_posts_title_as_link').removeClass('mailpoet_hidden');
}
this.changeField('titleFormat', event);
},
}
});
Module.PostsWidgetView = base.WidgetView.extend({
@ -572,19 +572,19 @@ define([
return new Module.PostsBlockModel({}, { parse: true });
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('posts', {
blockModel: Module.PostsBlockModel,
blockView: Module.PostsBlockView,
blockView: Module.PostsBlockView
});
App.registerWidget({
name: 'posts',
widgetView: Module.PostsWidgetView,
priority: 96,
priority: 96
});
});

View File

@ -30,7 +30,7 @@ define([
image: App.getAvailableStyles().get('socialIconSets.default.custom'),
height: '32px',
width: '32px',
text: defaultValues.get('title'),
text: defaultValues.get('title')
};
},
initialize: function(options) {
@ -42,11 +42,11 @@ define([
this.set({
link: defaultValues.get('defaultLink'),
image: iconSet.get(that.get('iconType')),
text: defaultValues.get('title'),
text: defaultValues.get('title')
});
}, this);
this.on('change', function() { App.getChannel().trigger('autoSave'); });
},
}
});
Module.SocialIconCollectionModel = Backbone.Collection.extend({
@ -59,11 +59,11 @@ define([
return this._getDefaults({
type: 'social',
iconSet: 'default',
icons: new Module.SocialIconCollectionModel(),
icons: new Module.SocialIconCollectionModel()
}, App.getConfig().get('blockDefaults.social'));
},
relations: {
icons: Module.SocialIconCollectionModel,
icons: Module.SocialIconCollectionModel
},
initialize: function() {
this.get('icons').on('add remove change', this._iconsChanged, this);
@ -80,27 +80,27 @@ define([
},
_iconsChanged: function() {
App.getChannel().trigger('autoSave');
},
}
});
var SocialIconView = Marionette.View.extend({
tagName: 'span',
getTemplate: function() { return templates.socialIconBlock; },
modelEvents: {
'change': 'render',
'change': 'render'
},
templateContext: function() {
var allIconSets = App.getAvailableStyles().get('socialIconSets');
return {
model: this.model.toJSON(),
allIconSets: allIconSets.toJSON(),
imageMissingSrc: App.getConfig().get('urls.imageMissing'),
imageMissingSrc: App.getConfig().get('urls.imageMissing')
};
},
}
});
Module.SocialIconCollectionView = Marionette.CollectionView.extend({
childView: SocialIconView,
childView: SocialIconView
});
Module.SocialBlockView = base.BlockView.extend({
@ -113,7 +113,7 @@ define([
tools: '> .mailpoet_tools'
},
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
ShowSettingsBehavior: {},
ShowSettingsBehavior: {}
}),
onDragSubstituteBy: function() { return Module.SocialWidgetView; },
onRender: function() {
@ -122,11 +122,11 @@ define([
this.showChildView('icons', new Module.SocialIconCollectionView({
collection: this.model.get('icons')
}))
},
}
});
Module.SocialBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.SocialBlockSettingsView; },
getSettingsView: function() { return Module.SocialBlockSettingsView; }
});
// Sidebar view container
@ -134,11 +134,11 @@ define([
getTemplate: function() { return templates.socialBlockSettings; },
regions: {
iconRegion: '#mailpoet_social_icons_selection',
stylesRegion: '#mailpoet_social_icons_styles',
stylesRegion: '#mailpoet_social_icons_styles'
},
events: function() {
return {
"click .mailpoet_done_editing": "close",
"click .mailpoet_done_editing": "close"
};
},
initialize: function() {
@ -162,7 +162,7 @@ define([
"change .mailpoet_social_icon_field_type": _.partial(this.changeField, "iconType"),
"input .mailpoet_social_icon_field_image": _.partial(this.changeField, "image"),
"input .mailpoet_social_icon_field_link": this.changeLink,
"input .mailpoet_social_icon_field_text": _.partial(this.changeField, "text"),
"input .mailpoet_social_icon_field_text": _.partial(this.changeField, "text")
};
},
modelEvents: {
@ -172,7 +172,7 @@ define([
},
'change:text': function() {
this.$('.mailpoet_social_icon_image').attr('alt', this.model.get('text'));
},
}
},
templateContext: function() {
var icons = App.getConfig().get('socialIcons'),
@ -182,7 +182,7 @@ define([
return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
iconTypes: availableIconTypes,
currentType: icons.get(this.model.get('iconType')).toJSON(),
allIconSets: allIconSets.toJSON(),
allIconSets: allIconSets.toJSON()
});
},
deleteIcon: function() {
@ -197,17 +197,17 @@ define([
},
changeField: function(field, event) {
this.model.set(field, jQuery(event.target).val());
},
}
});
SocialBlockSettingsIconCollectionView = Marionette.CollectionView.extend({
behaviors: {
SortableBehavior: {
items: '> div',
},
items: '> div'
}
},
childViewContainer: '#mailpoet_social_icon_selector_contents',
childView: SocialBlockSettingsIconView,
childView: SocialBlockSettingsIconView
});
// Select icons section container view
@ -217,10 +217,10 @@ define([
'icons': '#mailpoet_social_icon_selector_contents'
},
events: {
'click .mailpoet_add_social_icon': 'addSocialIcon',
'click .mailpoet_add_social_icon': 'addSocialIcon'
},
modelEvents: {
'change:iconSet': 'render',
'change:iconSet': 'render'
},
addSocialIcon: function() {
// Add a social icon with default values
@ -237,10 +237,10 @@ define([
SocialBlockSettingsStylesView = Marionette.View.extend({
getTemplate: function() { return templates.socialSettingsStyles; },
modelEvents: {
'change': 'render',
'change': 'render'
},
events: {
'click .mailpoet_social_icon_set': 'changeSocialIconSet',
'click .mailpoet_social_icon_set': 'changeSocialIconSet'
},
initialize: function() {
this.listenTo(this.model.get('icons'), 'add remove change', this.render);
@ -251,7 +251,7 @@ define([
activeSet: this.model.get('iconSet'),
socialIconSets: allIconSets.toJSON(),
availableSets: _.keys(allIconSets.toJSON()),
availableSocialIcons: this.model.get('icons').pluck('iconType'),
availableSocialIcons: this.model.get('icons').pluck('iconType')
};
},
changeSocialIconSet: function(event) {
@ -259,7 +259,7 @@ define([
},
onBeforeDestroy: function() {
this.model.get('icons').off('add remove', this.render, this);
},
}
});
Module.SocialWidgetView = base.WidgetView.extend({
@ -279,7 +279,7 @@ define([
image: App.getAvailableStyles().get('socialIconSets.default.facebook'),
height: '32px',
width: '32px',
text: 'Facebook',
text: 'Facebook'
},
{
type: 'socialIcon',
@ -288,25 +288,25 @@ define([
image: App.getAvailableStyles().get('socialIconSets.default.twitter'),
height: '32px',
width: '32px',
text: 'Twitter',
},
],
text: 'Twitter'
}
]
}, { parse: true });
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('social', {
blockModel: Module.SocialBlockModel,
blockView: Module.SocialBlockView,
blockView: Module.SocialBlockView
});
App.registerWidget({
name: 'social',
widgetView: Module.SocialWidgetView,
priority: 95,
priority: 95
});
});

View File

@ -19,11 +19,11 @@ define([
styles: {
block: {
backgroundColor: 'transparent',
height: '40px',
},
},
height: '40px'
}
}
}, App.getConfig().get('blockDefaults.spacer'));
},
}
});
Module.SpacerBlockView = base.BlockView.extend({
@ -34,11 +34,11 @@ define([
elementSelector: '.mailpoet_spacer',
resizeHandleSelector: '.mailpoet_resize_handle',
minLength: 20, // TODO: Move this number to editor configuration
modelField: 'styles.block.height',
modelField: 'styles.block.height'
},
ShowSettingsBehavior: {
ignoreFrom: '.mailpoet_resize_handle'
},
}
}, base.BlockView.prototype.behaviors),
modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
onDragSubstituteBy: function() { return Module.SpacerWidgetView; },
@ -58,11 +58,11 @@ define([
},
onBeforeDestroy: function() {
this.stopListening(this.model);
},
}
});
Module.SpacerBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.SpacerBlockSettingsView; },
getSettingsView: function() { return Module.SpacerBlockSettingsView; }
});
Module.SpacerBlockSettingsView = base.BlockSettingsView.extend({
@ -70,9 +70,9 @@ define([
events: function() {
return {
"change .mailpoet_field_spacer_background_color": _.partial(this.changeColorField, "styles.block.backgroundColor"),
"click .mailpoet_done_editing": "close",
"click .mailpoet_done_editing": "close"
};
},
}
});
Module.SpacerWidgetView = base.WidgetView.extend({
@ -82,21 +82,21 @@ define([
cloneOriginal: true,
drop: function() {
return new Module.SpacerBlockModel();
},
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('spacer', {
blockModel: Module.SpacerBlockModel,
blockView: Module.SpacerBlockView,
blockView: Module.SpacerBlockView
});
App.registerWidget({
name: 'spacer',
widgetView: Module.SpacerWidgetView,
priority: 94,
priority: 94
});
});

View File

@ -16,9 +16,9 @@ define([
defaults: function() {
return this._getDefaults({
type: 'text',
text: 'Edit this to insert text',
text: 'Edit this to insert text'
}, App.getConfig().get('blockDefaults.text'));
},
}
});
Module.TextBlockView = base.BlockView.extend({
@ -36,16 +36,16 @@ define([
configurationFilter: function(originalSettings) {
return _.extend({}, originalSettings, {
mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle'),
mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
});
}
},
}
}),
initialize: function(options) {
base.BlockView.prototype.initialize.apply(this, arguments);
this.renderOptions = _.defaults(options.renderOptions || {}, {
disableTextEditor: false,
disableTextEditor: false
});
this.disableTextEditor = this.renderOptions.disableTextEditor;
@ -55,8 +55,8 @@ define([
this.toolsView = new Module.TextBlockToolsView({
model: this.model,
tools: {
settings: false,
},
settings: false
}
});
this.showChildView('toolsRegion', this.toolsView);
},
@ -70,15 +70,15 @@ define([
onTextEditorBlur: function() {
this.enableDragging();
this.enableShowingTools();
},
}
});
Module.TextBlockToolsView = base.BlockToolsView.extend({
getSettingsView: function() { return Module.TextBlockSettingsView; },
getSettingsView: function() { return Module.TextBlockSettingsView; }
});
Module.TextBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.textBlockSettings; },
getTemplate: function() { return templates.textBlockSettings; }
});
Module.TextWidgetView = base.WidgetView.extend({
@ -88,21 +88,21 @@ define([
cloneOriginal: true,
drop: function() {
return new Module.TextBlockModel();
},
}
}
},
}
});
App.on('before:start', function(App, options) {
App.registerBlockType('text', {
blockModel: Module.TextBlockModel,
blockView: Module.TextBlockView,
blockView: Module.TextBlockView
});
App.registerWidget({
name: 'text',
widgetView: Module.TextWidgetView,
priority: 90,
priority: 90
});
});

View File

@ -12,8 +12,8 @@ define([
blockDefaults: {},
sidepanelWidth: '331px',
validation: {},
urls: {},
},
urls: {}
}
});
// Global and available styles for access in blocks and their settings

View File

@ -22,7 +22,7 @@ define([
// Use only whitelisted properties to ensure properties editor
// doesn't control don't change.
return _.pick(SuperModel.prototype.toJSON.call(this), this.whitelisted);
},
}
});
// Content block view and model handlers for different content types
@ -48,13 +48,13 @@ define([
Module.getBody = function() {
return {
content: App._contentContainer.toJSON(),
globalStyles: App.getGlobalStyles().toJSON(),
globalStyles: App.getGlobalStyles().toJSON()
};
};
Module.toJSON = function() {
return _.extend({
body: Module.getBody(),
body: Module.getBody()
}, App.getNewsletter().toJSON());
};
@ -94,7 +94,7 @@ define([
App._contentContainer = new (App.getBlockTypeModel('container'))(content, {parse: true});
App._contentContainerView = new (App.getBlockTypeView('container'))({
model: App._contentContainer,
renderOptions: { depth: 0 },
renderOptions: { depth: 0 }
});
App._appView.showChildView('contentRegion', App._contentContainerView);

View File

@ -14,18 +14,18 @@ define([
getTemplate: function() { return templates.heading; },
templateContext: function() {
return {
model: this.model.toJSON(),
model: this.model.toJSON()
};
},
events: function() {
return {
'keyup .mailpoet_input_title': _.partial(this.changeField, "subject"),
'keyup .mailpoet_input_preheader': _.partial(this.changeField, "preheader"),
'keyup .mailpoet_input_preheader': _.partial(this.changeField, "preheader")
};
},
changeField: function(field, event) {
this.model.set(field, jQuery(event.target).val());
},
}
});
App.on('start', function(App, options) {

View File

@ -49,7 +49,7 @@ define([
MailPoet.Notice.error(
MailPoet.I18n.t('templateSaveFailed'),
{
scroll: true,
scroll: true
}
);
} else {
@ -105,7 +105,7 @@ define([
promise.then(function(thumbnail) {
var data = _.extend(options || {}, {
thumbnail: thumbnail.toDataURL('image/jpeg'),
body: JSON.stringify(App.getBody()),
body: JSON.stringify(App.getBody())
});
return MailPoet.Ajax.post({
@ -132,7 +132,7 @@ define([
).then(function(thumbnail) {
var data = _.extend(options || {}, {
thumbnail: thumbnail.toDataURL('image/jpeg'),
body: App.getBody(),
body: App.getBody()
});
var blob = new Blob(
[JSON.stringify(data)],
@ -154,7 +154,7 @@ define([
'click .mailpoet_save_as_template': 'saveAsTemplate',
/* Export template */
'click .mailpoet_save_export': 'toggleExportTemplate',
'click .mailpoet_export_template': 'exportTemplate',
'click .mailpoet_export_template': 'exportTemplate'
},
initialize: function(options) {
App.getChannel().on('beforeEditorSave', this.beforeSave, this);
@ -202,7 +202,7 @@ define([
MailPoet.I18n.t('templateNameMissing'),
{
positionAfter: that.$el,
scroll: true,
scroll: true
}
);
} else if (templateDescription === '') {
@ -210,19 +210,19 @@ define([
MailPoet.I18n.t('templateDescriptionMissing'),
{
positionAfter: that.$el,
scroll: true,
scroll: true
}
);
} else {
Module.saveTemplate({
name: templateName,
description: templateDescription,
description: templateDescription
}).done(function() {
MailPoet.Notice.success(
MailPoet.I18n.t('templateSaved'),
{
positionAfter: that.$el,
scroll: true,
scroll: true
}
);
}).fail(function() {
@ -230,7 +230,7 @@ define([
MailPoet.I18n.t('templateSaveFailed'),
{
positionAfter: that.$el,
scroll: true,
scroll: true
}
);
});
@ -255,7 +255,7 @@ define([
MailPoet.I18n.t('templateNameMissing'),
{
positionAfter: that.$el,
scroll: true,
scroll: true
}
);
} else if (templateDescription === '') {
@ -263,13 +263,13 @@ define([
MailPoet.I18n.t('templateDescriptionMissing'),
{
positionAfter: that.$el,
scroll: true,
scroll: true
}
);
} else {
Module.exportTemplate({
name: templateName,
description: templateDescription,
description: templateDescription
});
this.hideExportTemplate();
}
@ -311,7 +311,7 @@ define([
hideValidationError: function() {
this.$('.mailpoet_save_error').addClass('mailpoet_hidden');
this.$('.mailpoet_save_next').removeClass('button-disabled');
},
}
});
Module.autoSave = function() {

View File

@ -30,10 +30,10 @@ define([
defaults: {
name: '',
priority: 100,
widgetView: undefined,
},
widgetView: undefined
}
}),
comparator: 'priority',
comparator: 'priority'
}))();
Module.registerWidget = function(widget) { return Module._contentWidgets.add(widget); };
Module.getWidgets = function() { return Module._contentWidgets; };
@ -44,10 +44,10 @@ define([
defaults: {
name: '',
priority: 100,
widgetView: undefined,
},
widgetView: undefined
}
}),
comparator: 'priority',
comparator: 'priority'
}))();
Module.registerLayoutWidget = function(widget) { return Module._layoutWidgets.add(widget); };
Module.getLayoutWidgets = function() { return Module._layoutWidgets; };
@ -58,7 +58,7 @@ define([
contentRegion: '.mailpoet_content_region',
layoutRegion: '.mailpoet_layout_region',
stylesRegion: '.mailpoet_styles_region',
previewRegion: '.mailpoet_preview_region',
previewRegion: '.mailpoet_preview_region'
},
events: {
'click .mailpoet_sidebar_region h3, .mailpoet_sidebar_region .handlediv': function(event) {
@ -84,11 +84,11 @@ define([
easing: "easeIn",
complete: function() {
$targetRegion.removeClass('closed');
},
}
}
);
}
},
}
},
initialize: function(options) {
jQuery(window)
@ -104,7 +104,7 @@ define([
));
this.showChildView('stylesRegion', new Module.SidebarStylesView({
model: App.getGlobalStyles(),
availableStyles: App.getAvailableStyles(),
availableStyles: App.getAvailableStyles()
}));
this.showChildView('previewRegion', new Module.SidebarPreviewView());
},
@ -127,13 +127,13 @@ define([
},
onDomRefresh: function() {
this.$el.parent().stick_in_parent({
offset_top: 32,
offset_top: 32
});
this.$el.parent().on('sticky_kit:stick', this.updateHorizontalScroll.bind(this));
this.$el.parent().on('sticky_kit:unstick', this.updateHorizontalScroll.bind(this));
this.$el.parent().on('sticky_kit:bottom', this.updateHorizontalScroll.bind(this));
this.$el.parent().on('sticky_kit:unbottom', this.updateHorizontalScroll.bind(this));
},
}
});
/**
@ -167,7 +167,7 @@ define([
* Responsible for rendering draggable layout widgets
*/
Module.SidebarLayoutWidgetsView = Module.SidebarWidgetsView.extend({
getTemplate: function() { return templates.sidebarLayout; },
getTemplate: function() { return templates.sidebarLayout; }
});
/**
@ -176,7 +176,7 @@ define([
Module.SidebarStylesView = Marionette.View.extend({
getTemplate: function() { return templates.sidebarStyles; },
behaviors: {
ColorPickerBehavior: {},
ColorPickerBehavior: {}
},
events: function() {
return {
@ -213,13 +213,13 @@ define([
this.model.set('link.textDecoration', (event.target.checked) ? event.target.value : 'none');
},
"change #mailpoet_newsletter_background_color": _.partial(this.changeColorField, 'wrapper.backgroundColor'),
"change #mailpoet_background_color": _.partial(this.changeColorField, 'body.backgroundColor'),
"change #mailpoet_background_color": _.partial(this.changeColorField, 'body.backgroundColor')
};
},
templateContext: function() {
return {
model: this.model.toJSON(),
availableStyles: this.availableStyles.toJSON(),
availableStyles: this.availableStyles.toJSON()
};
},
initialize: function(options) {
@ -234,14 +234,14 @@ define([
value = 'transparent';
}
this.model.set(field, value);
},
}
});
Module.SidebarPreviewView = Marionette.View.extend({
getTemplate: function() { return templates.sidebarPreview; },
events: {
'click .mailpoet_show_preview': 'showPreview',
'click #mailpoet_send_preview': 'sendPreview',
'click #mailpoet_send_preview': 'sendPreview'
},
onBeforeDestroy: function() {
if (this.previewView) {
@ -263,7 +263,7 @@ define([
api_version: window.mailpoet_api_version,
endpoint: 'newsletters',
action: 'showPreview',
data: json,
data: json
}).always(function() {
MailPoet.Modal.loading(false);
}).done(function(response) {
@ -296,7 +296,7 @@ define([
var $emailField = this.$('#mailpoet_preview_to_email');
var data = {
subscriber: $emailField.val(),
id: App.getNewsletter().get('id'),
id: App.getNewsletter().get('id')
};
if (data.subscriber.length <= 0) {
@ -304,7 +304,7 @@ define([
MailPoet.I18n.t('newsletterPreviewEmailMissing'),
{
positionAfter: $emailField,
scroll: true,
scroll: true
}
);
return false;
@ -333,7 +333,7 @@ define([
}
});
});
},
}
});
Module.NewsletterPreviewView = Marionette.View.extend({
@ -347,7 +347,7 @@ define([
return {
previewUrl: this.previewUrl,
width: this.width,
height: this.height,
height: this.height
};
}
});

View File

@ -13,7 +13,7 @@ define([
text: {
fontColor: '#000000',
fontFamily: 'Arial',
fontSize: '16px',
fontSize: '16px'
},
h1: {
fontColor: '#111111',
@ -23,33 +23,33 @@ define([
h2: {
fontColor: '#222222',
fontFamily: 'Tahoma',
fontSize: '32px',
fontSize: '32px'
},
h3: {
fontColor: '#333333',
fontFamily: 'Verdana',
fontSize: '24px',
fontSize: '24px'
},
link: {
fontColor: '#21759B',
textDecoration: 'underline',
textDecoration: 'underline'
},
wrapper: {
backgroundColor: '#ffffff',
backgroundColor: '#ffffff'
},
body: {
backgroundColor: '#cccccc',
},
backgroundColor: '#cccccc'
}
},
initialize: function() {
this.on('change', function() { App.getChannel().trigger('autoSave'); });
},
}
});
Module.StylesView = Marionette.View.extend({
getTemplate: function() { return templates.styles; },
modelEvents: {
'change': 'render',
'change': 'render'
},
serializeData: function() {
return this.model.toJSON();

View File

@ -31,7 +31,7 @@ tinymce.PluginManager.add('mailpoet_shortcodes', function(editor, url) {
if (configShortcodes.hasOwnProperty(segment)) {
shortcodes.push({
type: 'label',
text: segment,
text: segment
});
for (var i = 0; i < configShortcodes[segment].length; i += 1) {
@ -51,8 +51,8 @@ tinymce.PluginManager.add('mailpoet_shortcodes', function(editor, url) {
autoScroll: true,
title: editor.settings.mailpoet_shortcodes_window_title,
body: shortcodes,
buttons: [],
buttons: []
});
},
}
});
});

View File

@ -13,15 +13,15 @@ ImageAndTextTemplateWidgetView = EditorApplication.module('blocks.base').WidgetV
orientation: 'horizontal',
blocks: [
{
type: 'image',
type: 'image'
},
{
type: 'text',
text: 'Some random text',
},
],
text: 'Some random text'
}
]
}, {parse: true});
},
}
}
},
}
});

View File

@ -6,16 +6,16 @@ import Badge from './badge.jsx';
const badges = {
excellent: {
name: MailPoet.I18n.t('excellentBadgeName'),
tooltipTitle: MailPoet.I18n.t('excellentBadgeTooltip')
tooltipTitle: MailPoet.I18n.t('excellentBadgeTooltip'),
},
good: {
name: MailPoet.I18n.t('goodBadgeName'),
tooltipTitle: MailPoet.I18n.t('goodBadgeTooltip')
tooltipTitle: MailPoet.I18n.t('goodBadgeTooltip'),
},
bad: {
name: MailPoet.I18n.t('badBadgeName'),
tooltipTitle: MailPoet.I18n.t('badBadgeTooltip')
}
tooltipTitle: MailPoet.I18n.t('badBadgeTooltip'),
},
};
const stats = {
@ -24,7 +24,7 @@ const stats = {
badgeTypes: [
'excellent',
'good',
'bad'
'bad',
],
tooltipText: MailPoet.I18n.t('openedStatTooltip'),
},
@ -33,18 +33,18 @@ const stats = {
badgeTypes: [
'excellent',
'good',
'bad'
'bad',
],
tooltipText: MailPoet.I18n.t('clickedStatTooltip')
tooltipText: MailPoet.I18n.t('clickedStatTooltip'),
},
unsubscribed: {
badgeRanges: [3, 1, 0],
badgeTypes: [
'bad',
'good',
'excellent'
'excellent',
],
tooltipText: MailPoet.I18n.t('unsubscribedStatTooltip')
tooltipText: MailPoet.I18n.t('unsubscribedStatTooltip'),
},
};

View File

@ -3,7 +3,7 @@ define(
'react',
'react-router',
'classnames',
'mailpoet'
'mailpoet',
],
(
React,
@ -21,21 +21,21 @@ define(
{
name: 'type',
label: MailPoet.I18n.t('selectType'),
link: '/new'
link: '/new',
},
{
name: 'template',
label: MailPoet.I18n.t('template')
label: MailPoet.I18n.t('template'),
},
{
name: 'editor',
label: MailPoet.I18n.t('designer')
label: MailPoet.I18n.t('designer'),
},
{
name: 'send',
label: MailPoet.I18n.t('send')
}
]
label: MailPoet.I18n.t('send'),
},
],
};
},
render: function () {
@ -67,7 +67,7 @@ define(
{ steps }
</p>
);
}
},
});
return Breadcrumb;

View File

@ -16,8 +16,8 @@ const _QueueMixin = {
endpoint: 'sendingQueue',
action: 'pause',
data: {
newsletter_id: newsletter.id
}
newsletter_id: newsletter.id,
},
}).done(() => {
jQuery('#resume_'+newsletter.id).show();
jQuery('#pause_'+newsletter.id).hide();
@ -36,8 +36,8 @@ const _QueueMixin = {
endpoint: 'sendingQueue',
action: 'resume',
data: {
newsletter_id: newsletter.id
}
newsletter_id: newsletter.id,
},
}).done(() => {
jQuery('#pause_'+newsletter.id).show();
jQuery('#resume_'+newsletter.id).hide();
@ -84,7 +84,7 @@ const _QueueMixin = {
<span>
{
MailPoet.I18n.t('newsletterQueueCompleted')
.replace("%$1d",newsletter.queue.count_processed)
.replace("%$1d", newsletter.queue.count_processed)
.replace("%$2d", newsletter.queue.count_total)
}
</span>
@ -301,7 +301,7 @@ const _StatisticsMixin = {
{after_content}
</div>
);
}
},
};
const _MailerMixin = {
@ -356,7 +356,7 @@ const _MailerMixin = {
MailPoet.Ajax.post({
api_version: window.mailpoet_api_version,
endpoint: 'mailer',
action: 'resumeSending'
action: 'resumeSending',
}).done(() => {
MailPoet.Notice.hide('mailpoet_mailer_error');
MailPoet.Notice.success(MailPoet.I18n.t('mailerSendingResumedNotice'));
@ -369,7 +369,7 @@ const _MailerMixin = {
);
}
});
}
},
};

View File

@ -13,7 +13,7 @@ import {
timeOfDayValues,
weekDayValues,
monthDayValues,
nthWeekDayValues
nthWeekDayValues,
} from 'newsletters/scheduling/common.jsx';
const messages = {
@ -61,42 +61,42 @@ const messages = {
).replace('%$1d', count.toLocaleString());
}
MailPoet.Notice.success(message);
}
},
};
const columns = [
{
name: 'subject',
label: MailPoet.I18n.t('subject'),
sortable: true
sortable: true,
},
{
name: 'status',
label: MailPoet.I18n.t('status'),
width: 100
width: 100,
},
{
name: 'settings',
label: MailPoet.I18n.t('settings')
label: MailPoet.I18n.t('settings'),
},
{
name: 'history',
label: MailPoet.I18n.t('history'),
width: 100
width: 100,
},
{
name: 'updated_at',
label: MailPoet.I18n.t('lastModifiedOn'),
sortable: true
}
sortable: true,
},
];
const bulk_actions = [
{
name: 'trash',
label: MailPoet.I18n.t('moveToTrash'),
onSuccess: messages.onTrash
}
onSuccess: messages.onTrash,
},
];
const newsletter_actions = [
@ -108,7 +108,7 @@ const newsletter_actions = [
{MailPoet.I18n.t('preview')}
</a>
);
}
},
},
{
name: 'edit',
@ -118,7 +118,7 @@ const newsletter_actions = [
{MailPoet.I18n.t('edit')}
</a>
);
}
},
},
{
name: 'duplicate',
@ -129,8 +129,8 @@ const newsletter_actions = [
endpoint: 'newsletters',
action: 'duplicate',
data: {
id: newsletter.id
}
id: newsletter.id,
},
}).done((response) => {
MailPoet.Notice.success(
(MailPoet.I18n.t('newsletterDuplicated')).replace(
@ -146,11 +146,11 @@ const newsletter_actions = [
);
}
});
}
},
},
{
name: 'trash'
}
name: 'trash',
},
];
const NewsletterListNotification = React.createClass({
@ -166,8 +166,8 @@ const NewsletterListNotification = React.createClass({
action: 'setStatus',
data: {
id: ~~(e.target.getAttribute('data-id')),
status: e.target.value
}
status: e.target.value,
},
}).done((response) => {
if (response.data.status === 'active') {
MailPoet.Notice.success(MailPoet.I18n.t('postNotificationActivated'));
@ -335,7 +335,7 @@ const NewsletterListNotification = React.createClass({
/>
</div>
);
}
},
});
module.exports = NewsletterListNotification;

View File

@ -10,7 +10,7 @@ import ListingTabs from 'newsletters/listings/tabs.jsx';
import {
QueueMixin,
StatisticsMixin,
MailerMixin
MailerMixin,
} from 'newsletters/listings/mixins.jsx';
const mailpoet_tracking_enabled = (!!(window['mailpoet_tracking_enabled']));
@ -22,21 +22,21 @@ const columns = [
},
{
name: 'status',
label: MailPoet.I18n.t('status')
label: MailPoet.I18n.t('status'),
},
{
name: 'segments',
label: MailPoet.I18n.t('lists')
label: MailPoet.I18n.t('lists'),
},
{
name: 'statistics',
label: MailPoet.I18n.t('statistics'),
display: mailpoet_tracking_enabled
display: mailpoet_tracking_enabled,
},
{
name: 'sent_at',
label: MailPoet.I18n.t('sentOn'),
}
},
];
let newsletter_actions = [
@ -48,8 +48,8 @@ let newsletter_actions = [
{MailPoet.I18n.t('preview')}
</a>
);
}
}
},
},
];
newsletter_actions = Hooks.applyFilters('mailpoet_newsletters_listings_notification_history_actions', newsletter_actions);
@ -126,7 +126,7 @@ const NewsletterListNotificationHistory = React.createClass({
/>
</div>
);
}
},
});
module.exports = NewsletterListNotificationHistory;

View File

@ -10,7 +10,7 @@ import ListingTabs from 'newsletters/listings/tabs.jsx';
import {
QueueMixin,
StatisticsMixin,
MailerMixin
MailerMixin,
} from 'newsletters/listings/mixins.jsx';
const mailpoet_tracking_enabled = (!!(window['mailpoet_tracking_enabled']));
@ -60,41 +60,41 @@ const messages = {
).replace('%$1d', count.toLocaleString());
}
MailPoet.Notice.success(message);
}
},
};
const columns = [
{
name: 'subject',
label: MailPoet.I18n.t('subject'),
sortable: true
sortable: true,
},
{
name: 'status',
label: MailPoet.I18n.t('status')
label: MailPoet.I18n.t('status'),
},
{
name: 'segments',
label: MailPoet.I18n.t('lists')
label: MailPoet.I18n.t('lists'),
},
{
name: 'statistics',
label: MailPoet.I18n.t('statistics'),
display: mailpoet_tracking_enabled
display: mailpoet_tracking_enabled,
},
{
name: 'sent_at',
label: MailPoet.I18n.t('sentOn'),
sortable: true
}
sortable: true,
},
];
const bulk_actions = [
{
name: 'trash',
label: MailPoet.I18n.t('moveToTrash'),
onSuccess: messages.onTrash
}
onSuccess: messages.onTrash,
},
];
let newsletter_actions = [
@ -106,7 +106,7 @@ let newsletter_actions = [
{MailPoet.I18n.t('preview')}
</a>
);
}
},
},
{
name: 'edit',
@ -116,7 +116,7 @@ let newsletter_actions = [
{MailPoet.I18n.t('edit')}
</a>
);
}
},
},
{
name: 'duplicate',
@ -127,8 +127,8 @@ let newsletter_actions = [
endpoint: 'newsletters',
action: 'duplicate',
data: {
id: newsletter.id
}
id: newsletter.id,
},
}).done((response) => {
MailPoet.Notice.success(
(MailPoet.I18n.t('newsletterDuplicated')).replace(
@ -144,11 +144,11 @@ let newsletter_actions = [
);
}
});
}
},
},
{
name: 'trash'
}
name: 'trash',
},
];
newsletter_actions = Hooks.applyFilters('mailpoet_newsletters_listings_standard_actions', newsletter_actions);
@ -222,7 +222,7 @@ const NewsletterListStandard = React.createClass({
/>
</div>
);
}
},
});
module.exports = NewsletterListStandard;

View File

@ -11,19 +11,19 @@ const ListingTabs = React.createClass({
{
name: 'standard',
label: MailPoet.I18n.t('tabStandardTitle'),
link: '/standard'
link: '/standard',
},
{
name: 'welcome',
label: MailPoet.I18n.t('tabWelcomeTitle'),
link: '/welcome'
link: '/welcome',
},
{
name: 'notification',
label: MailPoet.I18n.t('tabNotificationTitle'),
link: '/notification'
}
]
link: '/notification',
},
],
};
},
render() {
@ -47,7 +47,7 @@ const ListingTabs = React.createClass({
{ tabs }
</h2>
);
}
},
});
module.exports = ListingTabs;

View File

@ -60,42 +60,42 @@ const messages = {
).replace('%$1d', count.toLocaleString());
}
MailPoet.Notice.success(message);
}
},
};
const columns = [
{
name: 'subject',
label: MailPoet.I18n.t('subject'),
sortable: true
sortable: true,
},
{
name: 'status',
label: MailPoet.I18n.t('status'),
width: 145
width: 145,
},
{
name: 'settings',
label: MailPoet.I18n.t('settings')
label: MailPoet.I18n.t('settings'),
},
{
name: 'statistics',
label: MailPoet.I18n.t('statistics'),
display: mailpoet_tracking_enabled
display: mailpoet_tracking_enabled,
},
{
name: 'updated_at',
label: MailPoet.I18n.t('lastModifiedOn'),
sortable: true
}
sortable: true,
},
];
const bulk_actions = [
{
name: 'trash',
label: MailPoet.I18n.t('moveToTrash'),
onSuccess: messages.onTrash
}
onSuccess: messages.onTrash,
},
];
let newsletter_actions = [
@ -107,7 +107,7 @@ let newsletter_actions = [
{MailPoet.I18n.t('preview')}
</a>
);
}
},
},
{
name: 'edit',
@ -117,11 +117,11 @@ let newsletter_actions = [
{MailPoet.I18n.t('edit')}
</a>
);
}
},
},
{
name: 'trash'
}
name: 'trash',
},
];
newsletter_actions = Hooks.applyFilters('mailpoet_newsletters_listings_welcome_notification_actions', newsletter_actions);
@ -139,8 +139,8 @@ const NewsletterListWelcome = React.createClass({
action: 'setStatus',
data: {
id: ~~(e.target.getAttribute('data-id')),
status: e.target.value
}
status: e.target.value,
},
}).done((response) => {
if (response.data.status === 'active') {
MailPoet.Notice.success(MailPoet.I18n.t('welcomeEmailActivated'));
@ -313,7 +313,7 @@ const NewsletterListWelcome = React.createClass({
/>
</div>
);
}
},
});
module.exports = NewsletterListWelcome;

View File

@ -21,7 +21,7 @@ const history = useRouterHistory(createHashHistory)({ queryKey: false });
const App = React.createClass({
render() {
return this.props.children;
}
},
});
const container = document.getElementById('newsletters_container');

View File

@ -8,7 +8,7 @@ const _timeDelayValues = {
'immediate': MailPoet.I18n.t('delayImmediately'),
'hours': MailPoet.I18n.t('delayHoursAfter'),
'days': MailPoet.I18n.t('delayDaysAfter'),
'weeks': MailPoet.I18n.t('delayWeeksAfter')
'weeks': MailPoet.I18n.t('delayWeeksAfter'),
};
const _intervalValues = {
@ -16,7 +16,7 @@ const _intervalValues = {
'weekly': MailPoet.I18n.t('weekly'),
'monthly': MailPoet.I18n.t('monthly'),
'nthWeekDay': MailPoet.I18n.t('monthlyEvery'),
'immediately': MailPoet.I18n.t('immediately')
'immediately': MailPoet.I18n.t('immediately'),
};
// notification emails
@ -25,7 +25,7 @@ const TIME_STEP_SECONDS = 3600;
const numberOfTimeSteps = SECONDS_IN_DAY / TIME_STEP_SECONDS;
const _timeOfDayValues = _.object(_.map(
_.times(numberOfTimeSteps,(step) => {
_.times(numberOfTimeSteps, (step) => {
return step * TIME_STEP_SECONDS;
}), (seconds) => {
const date = new Date(null);
@ -42,7 +42,7 @@ const _weekDayValues = {
3: MailPoet.I18n.t('wednesday'),
4: MailPoet.I18n.t('thursday'),
5: MailPoet.I18n.t('friday'),
6: MailPoet.I18n.t('saturday')
6: MailPoet.I18n.t('saturday'),
};
const NUMBER_OF_DAYS_IN_MONTH = 28;
@ -54,7 +54,7 @@ const _monthDayValues = _.object(
const labels = {
0: MailPoet.I18n.t('first'),
1: MailPoet.I18n.t('second'),
2: MailPoet.I18n.t('third')
2: MailPoet.I18n.t('third'),
};
let label;
if (labels[day] !== undefined) {
@ -71,7 +71,7 @@ const _nthWeekDayValues = {
'1': MailPoet.I18n.t('first'),
'2': MailPoet.I18n.t('second'),
'3': MailPoet.I18n.t('third'),
'L': MailPoet.I18n.t('last')
'L': MailPoet.I18n.t('last'),
};
export { _timeDelayValues as timeDelayValues };

View File

@ -8,7 +8,7 @@ define(
'newsletters/send/standard.jsx',
'newsletters/send/notification.jsx',
'newsletters/send/welcome.jsx',
'newsletters/breadcrumb.jsx'
'newsletters/breadcrumb.jsx',
],
(
React,
@ -24,7 +24,7 @@ define(
const NewsletterSend = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
router: React.PropTypes.object.isRequired,
},
getInitialState: function () {
return {
@ -68,18 +68,18 @@ define(
endpoint: 'newsletters',
action: 'get',
data: {
id: id
}
id: id,
},
}).done((response) => {
this.setState({
loading: false,
item: response.data,
fields: this.getFieldsByNewsletter(response.data)
fields: this.getFieldsByNewsletter(response.data),
});
}).fail(() => {
this.setState({
loading: false,
item: {}
item: {},
}, () => {
this.context.router.push('/new');
});
@ -103,8 +103,8 @@ define(
action: 'setStatus',
data: {
id: this.props.params.id,
status: 'active'
}
status: 'active',
},
}).done((response) => {
// redirect to listing based on newsletter type
this.context.router.push(`/${ this.state.item.type || '' }`);
@ -126,8 +126,8 @@ define(
endpoint: 'sendingQueue',
action: 'add',
data: {
newsletter_id: this.props.params.id
}
newsletter_id: this.props.params.id,
},
}).done((response) => {
// redirect to listing based on newsletter type
this.context.router.push(`/${ this.state.item.type || '' }`);
@ -179,7 +179,7 @@ define(
// Store only properties that can be changed on this page
const IGNORED_NEWSLETTER_PROPERTIES = [
'preheader', 'body', 'created_at', 'deleted_at', 'hash',
'status', 'updated_at', 'type'
'status', 'updated_at', 'type',
];
const newsletterData = _.omit(
data,
@ -210,7 +210,7 @@ define(
item[field] = e.target.value;
this.setState({
item: item
item: item,
});
return true;
},
@ -254,7 +254,7 @@ define(
</Form>
</div>
);
}
},
});
return NewsletterSend;

View File

@ -3,7 +3,7 @@ define(
'mailpoet',
'wp-js-hooks',
'newsletters/types/notification/scheduling.jsx',
'underscore'
'underscore',
],
(
MailPoet,
@ -20,8 +20,8 @@ define(
type: 'text',
validation: {
'data-parsley-required': true,
'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError')
}
'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError'),
},
},
{
name: 'options',
@ -55,8 +55,8 @@ define(
},
validation: {
'data-parsley-required': true,
'data-parsley-required-message': MailPoet.I18n.t('noSegmentsSelectedError')
}
'data-parsley-required-message': MailPoet.I18n.t('noSegmentsSelectedError'),
},
},
{
name: 'sender',
@ -68,8 +68,8 @@ define(
type: 'text',
placeholder: MailPoet.I18n.t('senderNamePlaceholder'),
validation: {
'data-parsley-required': true
}
'data-parsley-required': true,
},
},
{
name: 'sender_address',
@ -77,10 +77,10 @@ define(
placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
validation: {
'data-parsley-required': true,
'data-parsley-type': 'email'
}
}
]
'data-parsley-type': 'email',
},
},
],
},
{
name: 'reply-to',
@ -91,15 +91,15 @@ define(
{
name: 'reply_to_name',
type: 'text',
placeholder: MailPoet.I18n.t('replyToNamePlaceholder')
placeholder: MailPoet.I18n.t('replyToNamePlaceholder'),
},
{
name: 'reply_to_address',
type: 'text',
placeholder: MailPoet.I18n.t('replyToAddressPlaceholder')
}
]
}
placeholder: MailPoet.I18n.t('replyToAddressPlaceholder'),
},
],
},
];
fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
@ -110,7 +110,7 @@ define(
},
getSendButtonOptions: function () {
return {
value: MailPoet.I18n.t('activate')
value: MailPoet.I18n.t('activate'),
};
},
};

View File

@ -37,7 +37,7 @@ define(
MailPoet.I18n.t('september'),
MailPoet.I18n.t('october'),
MailPoet.I18n.t('november'),
MailPoet.I18n.t('december')
MailPoet.I18n.t('december'),
],
monthNamesShort: [
MailPoet.I18n.t('januaryShort'),
@ -51,7 +51,7 @@ define(
MailPoet.I18n.t('septemberShort'),
MailPoet.I18n.t('octoberShort'),
MailPoet.I18n.t('novemberShort'),
MailPoet.I18n.t('decemberShort')
MailPoet.I18n.t('decemberShort'),
],
dayNames: [
MailPoet.I18n.t('sunday'),
@ -60,7 +60,7 @@ define(
MailPoet.I18n.t('wednesday'),
MailPoet.I18n.t('thursday'),
MailPoet.I18n.t('friday'),
MailPoet.I18n.t('saturday')
MailPoet.I18n.t('saturday'),
],
dayNamesShort: [
MailPoet.I18n.t('sundayShort'),
@ -69,7 +69,7 @@ define(
MailPoet.I18n.t('wednesdayShort'),
MailPoet.I18n.t('thursdayShort'),
MailPoet.I18n.t('fridayShort'),
MailPoet.I18n.t('saturdayShort')
MailPoet.I18n.t('saturdayShort'),
],
dayNamesMin: [
MailPoet.I18n.t('sundayMin'),
@ -78,7 +78,7 @@ define(
MailPoet.I18n.t('wednesdayMin'),
MailPoet.I18n.t('thursdayMin'),
MailPoet.I18n.t('fridayMin'),
MailPoet.I18n.t('saturdayMin')
MailPoet.I18n.t('saturdayMin'),
],
};
@ -100,13 +100,13 @@ define(
// Transform string format to Date object
return MailPoet.Date.toDate(value, {
parseFormat: dateDisplayFormat,
format: format
format: format,
});
};
jQuery.datepicker.formatDate = function (format, value) {
// Transform Date object to string format
const newValue = MailPoet.Date.format(value, {
format: format
format: format,
});
return newValue;
};
@ -138,13 +138,13 @@ define(
getDisplayDate: function (date) {
return MailPoet.Date.format(date, {
parseFormat: this.props.storageFormat,
format: this.props.displayFormat
format: this.props.displayFormat,
});
},
getStorageDate: function (date) {
return MailPoet.Date.format(date, {
parseFormat: this.props.displayFormat,
format: this.props.storageFormat
format: this.props.storageFormat,
});
},
render: function () {
@ -186,7 +186,7 @@ define(
{options}
</select>
);
}
},
});
const DateTime = React.createClass({
@ -219,7 +219,7 @@ define(
target: {
name: this.props.name || '',
value: this.getDateTime(),
}
},
});
}
},
@ -243,7 +243,7 @@ define(
validation={this.props.timeValidation} />
</span>
);
}
},
});
const StandardScheduling = React.createClass({
@ -252,7 +252,7 @@ define(
this.props.item[this.props.field.name] || {},
{
isScheduled: '0',
scheduledAt: defaultDateTime
scheduledAt: defaultDateTime,
}
);
},
@ -264,8 +264,8 @@ define(
return this.props.onValueChange({
target: {
name: this.props.field.name,
value: _.extend({}, oldValue, newValue)
}
value: _.extend({}, oldValue, newValue),
},
});
},
handleCheckboxChange: function (event) {
@ -325,8 +325,8 @@ define(
type: 'text',
validation: {
'data-parsley-required': true,
'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError')
}
'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError'),
},
},
{
name: 'segments',
@ -354,8 +354,8 @@ define(
},
validation: {
'data-parsley-required': true,
'data-parsley-required-message': MailPoet.I18n.t('noSegmentsSelectedError')
}
'data-parsley-required-message': MailPoet.I18n.t('noSegmentsSelectedError'),
},
},
{
name: 'sender',
@ -367,8 +367,8 @@ define(
type: 'text',
placeholder: MailPoet.I18n.t('senderNamePlaceholder'),
validation: {
'data-parsley-required': true
}
'data-parsley-required': true,
},
},
{
name: 'sender_address',
@ -376,10 +376,10 @@ define(
placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
validation: {
'data-parsley-required': true,
'data-parsley-type': 'email'
}
}
]
'data-parsley-type': 'email',
},
},
],
},
{
name: 'reply-to',
@ -390,21 +390,21 @@ define(
{
name: 'reply_to_name',
type: 'text',
placeholder: MailPoet.I18n.t('replyToNamePlaceholder')
placeholder: MailPoet.I18n.t('replyToNamePlaceholder'),
},
{
name: 'reply_to_address',
type: 'text',
placeholder: MailPoet.I18n.t('replyToAddressPlaceholder')
}
]
placeholder: MailPoet.I18n.t('replyToAddressPlaceholder'),
},
],
},
{
name: 'options',
label: MailPoet.I18n.t('scheduleIt'),
type: 'reactComponent',
component: StandardScheduling,
}
},
];
fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
@ -423,7 +423,7 @@ define(
const options = {
value: (isScheduled
? MailPoet.I18n.t('schedule')
: MailPoet.I18n.t('send'))
: MailPoet.I18n.t('send')),
};
if (newsletter.status === 'sent'

View File

@ -2,7 +2,7 @@ define(
[
'mailpoet',
'wp-js-hooks',
'newsletters/types/welcome/scheduling.jsx'
'newsletters/types/welcome/scheduling.jsx',
],
(
MailPoet,
@ -19,8 +19,8 @@ define(
type: 'text',
validation: {
'data-parsley-required': true,
'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError')
}
'data-parsley-required-message': MailPoet.I18n.t('emptySubjectLineError'),
},
},
{
name: 'options',
@ -38,8 +38,8 @@ define(
type: 'text',
placeholder: MailPoet.I18n.t('senderNamePlaceholder'),
validation: {
'data-parsley-required': true
}
'data-parsley-required': true,
},
},
{
name: 'sender_address',
@ -47,10 +47,10 @@ define(
placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
validation: {
'data-parsley-required': true,
'data-parsley-type': 'email'
}
}
]
'data-parsley-type': 'email',
},
},
],
},
{
name: 'reply-to',
@ -61,15 +61,15 @@ define(
{
name: 'reply_to_name',
type: 'text',
placeholder: MailPoet.I18n.t('replyToNamePlaceholder')
placeholder: MailPoet.I18n.t('replyToNamePlaceholder'),
},
{
name: 'reply_to_address',
type: 'text',
placeholder: MailPoet.I18n.t('replyToAddressPlaceholder')
}
]
}
placeholder: MailPoet.I18n.t('replyToAddressPlaceholder'),
},
],
},
];
fields = Hooks.applyFilters('mailpoet_newsletters_3rd_step_fields', fields);
@ -80,7 +80,7 @@ define(
},
getSendButtonOptions: function () {
return {
value: MailPoet.I18n.t('activate')
value: MailPoet.I18n.t('activate'),
};
},
};

View File

@ -5,7 +5,7 @@ define(
'mailpoet',
'react-router',
'classnames',
'newsletters/breadcrumb.jsx'
'newsletters/breadcrumb.jsx',
],
(
React,
@ -30,7 +30,7 @@ define(
api_version: window.mailpoet_api_version,
endpoint: 'newsletterTemplates',
action: 'save',
data: template
data: template,
}).always(() => {
MailPoet.Modal.loading(false);
}).done((response) => {
@ -86,7 +86,7 @@ define(
getInitialState: function () {
return {
loading: false,
templates: []
templates: [],
};
},
componentDidMount: function () {
@ -112,13 +112,13 @@ define(
MailPoet.I18n.t('mailpoetGuideTemplateTitle'),
description:
MailPoet.I18n.t('mailpoetGuideTemplateDescription'),
readonly: "1"
}
readonly: "1",
},
];
}
this.setState({
templates: response.data,
loading: false
loading: false,
});
}
}).fail((response) => {
@ -144,8 +144,8 @@ define(
action: 'save',
data: {
id: this.props.params.id,
body: body
}
body: body,
},
}).done((response) => {
// TODO: Move this URL elsewhere
window.location = 'admin.php?page=mailpoet-newsletter-editor&id=' + response.data.id;
@ -172,8 +172,8 @@ define(
endpoint: 'newsletterTemplates',
action: 'delete',
data: {
id: template.id
}
id: template.id,
},
}).done(() => {
this.getTemplates();
}).fail((response) => {
@ -192,7 +192,7 @@ define(
MailPoet.Modal.popup({
title: template.name,
template: '<div class="mailpoet_boxes_preview" style="background-color: {{ body.globalStyles.body.backgroundColor }}"><img src="{{ thumbnail }}" /></div>',
data: template
data: template,
});
},
handleTemplateImport: function () {
@ -272,7 +272,7 @@ define(
<ImportTemplate onImport={this.handleTemplateImport} />
</div>
);
}
},
});
return NewsletterTemplates;

View File

@ -4,7 +4,7 @@ define(
'mailpoet',
'wp-js-hooks',
'react-router',
'newsletters/breadcrumb.jsx'
'newsletters/breadcrumb.jsx',
],
(
React,
@ -15,7 +15,7 @@ define(
) => {
const NewsletterTypes = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
router: React.PropTypes.object.isRequired,
},
setupNewsletter: function (type) {
if(type !== undefined) {
@ -30,7 +30,7 @@ define(
data: {
type: type,
subject: MailPoet.I18n.t('draftNewsletterTitle'),
}
},
}).done((response) => {
this.context.router.push(`/template/${response.data.id}`);
}).fail((response) => {
@ -54,7 +54,7 @@ define(
{MailPoet.I18n.t('create')}
</a>
);
}.bind(this)()
}.bind(this)(),
},
{
'id': 'welcome',
@ -68,7 +68,7 @@ define(
</a>
</div>
);
}()
}(),
},
{
'id': 'notification',
@ -80,8 +80,8 @@ define(
{MailPoet.I18n.t('setUp')}
</a>
);
}.bind(this)()
}
}.bind(this)(),
},
];
types = Hooks.applyFilters('mailpoet_newsletters_types', types, this);
@ -114,7 +114,7 @@ define(
</ul>
</div>
);
}
},
});
return NewsletterTypes;

View File

@ -5,7 +5,7 @@ define(
'react-router',
'mailpoet',
'newsletters/types/notification/scheduling.jsx',
'newsletters/breadcrumb.jsx'
'newsletters/breadcrumb.jsx',
],
(
_,
@ -24,7 +24,7 @@ define(
const NewsletterNotification = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
router: React.PropTypes.object.isRequired,
},
getInitialState: function () {
return {
@ -34,7 +34,7 @@ define(
weekDay: 1,
monthDay: 0,
nthWeekDay: 1,
}
},
};
},
handleValueChange: function (event) {

View File

@ -6,32 +6,32 @@ import {
timeOfDayValues,
weekDayValues,
monthDayValues,
nthWeekDayValues
nthWeekDayValues,
} from 'newsletters/scheduling/common.jsx';
const intervalField = {
name: 'intervalType',
values: intervalValues
values: intervalValues,
};
const timeOfDayField = {
name: 'timeOfDay',
values: timeOfDayValues
values: timeOfDayValues,
};
const weekDayField = {
name: 'weekDay',
values: weekDayValues
values: weekDayValues,
};
const monthDayField = {
name: 'monthDay',
values: monthDayValues
values: monthDayValues,
};
const nthWeekDayField = {
name: 'nthWeekDay',
values: nthWeekDayValues
values: nthWeekDayValues,
};
const NotificationScheduling = React.createClass({
@ -47,8 +47,8 @@ const NotificationScheduling = React.createClass({
return this.props.onValueChange({
target: {
name: this.props.field.name,
value: _.extend({}, oldValue, newValue)
}
value: _.extend({}, oldValue, newValue),
},
});
},
handleIntervalChange: function (event) {
@ -137,7 +137,7 @@ const NotificationScheduling = React.createClass({
{timeOfDaySelection}
</div>
);
}
},
});
module.exports = NotificationScheduling;

View File

@ -3,7 +3,7 @@ define(
'react',
'react-router',
'mailpoet',
'newsletters/breadcrumb.jsx'
'newsletters/breadcrumb.jsx',
],
(
React,
@ -14,7 +14,7 @@ define(
const NewsletterStandard = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
router: React.PropTypes.object.isRequired,
},
showTemplateSelection: function (newsletterId) {
this.context.router.push(`/template/${newsletterId}`);
@ -26,8 +26,8 @@ define(
endpoint: 'newsletters',
action: 'create',
data: {
type: 'standard'
}
type: 'standard',
},
}).done((response) => {
this.showTemplateSelection(response.data.id);
}).fail((response) => {

View File

@ -18,7 +18,7 @@ const events = {
values: {
'segment': MailPoet.I18n.t('onSubscriptionToList'),
'user': MailPoet.I18n.t('onWPUserRegistration'),
}
},
};
const availableSegmentValues = _.object(_.map(
@ -31,27 +31,27 @@ const availableSegmentValues = _.object(_.map(
const segmentField = {
name: 'segment',
values: availableSegmentValues,
sortBy: (key, value) => value.toLowerCase()
sortBy: (key, value) => value.toLowerCase(),
};
const roleField = {
name: 'role',
values: availableRoles
values: availableRoles,
};
const afterTimeNumberField = {
name: 'afterTimeNumber',
size: 3
size: 3,
};
const afterTimeTypeField = {
name: 'afterTimeType',
values: timeDelayValues
values: timeDelayValues,
};
const WelcomeScheduling = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
router: React.PropTypes.object.isRequired,
},
_getCurrentValue: function () {
return (this.props.item[this.props.field.name] || {});
@ -65,8 +65,8 @@ const WelcomeScheduling = React.createClass({
return this.props.onValueChange({
target: {
name: this.props.field.name,
value: _.extend({}, oldValue, newValue)
}
value: _.extend({}, oldValue, newValue),
},
});
},
handleEventChange: function (event) {
@ -106,8 +106,8 @@ const WelcomeScheduling = React.createClass({
action: 'create',
data: {
type: 'welcome',
options: this.state
}
options: this.state,
},
}).done((response) => {
this.showTemplateSelection(response.data.id);
}).fail((response) => {

View File

@ -3,7 +3,7 @@ define(
'react',
'react-router',
'mailpoet',
'form/form.jsx'
'form/form.jsx',
],
(
React,
@ -16,14 +16,14 @@ define(
{
name: 'name',
label: MailPoet.I18n.t('name'),
type: 'text'
type: 'text',
},
{
name: 'description',
label: MailPoet.I18n.t('description'),
type: 'textarea',
tip: MailPoet.I18n.t('segmentDescriptionTip')
}
tip: MailPoet.I18n.t('segmentDescriptionTip'),
},
];
const messages = {
@ -32,7 +32,7 @@ define(
},
onCreate: function () {
MailPoet.Notice.success(MailPoet.I18n.t('segmentAdded'));
}
},
};
const Link = Router.Link;
@ -54,7 +54,7 @@ define(
/>
</div>
);
}
},
});
return SegmentForm;

View File

@ -9,33 +9,33 @@ const columns = [
{
name: 'name',
label: MailPoet.I18n.t('name'),
sortable: true
sortable: true,
},
{
name: 'description',
label: MailPoet.I18n.t('description')
label: MailPoet.I18n.t('description'),
},
{
name: 'subscribed',
label: MailPoet.I18n.t('subscribed')
label: MailPoet.I18n.t('subscribed'),
},
{
name: 'unconfirmed',
label: MailPoet.I18n.t('unconfirmed')
label: MailPoet.I18n.t('unconfirmed'),
},
{
name: 'unsubscribed',
label: MailPoet.I18n.t('unsubscribed')
label: MailPoet.I18n.t('unsubscribed'),
},
{
name: 'bounced',
label: MailPoet.I18n.t('bounced')
label: MailPoet.I18n.t('bounced'),
},
{
name: 'created_at',
label: MailPoet.I18n.t('createdOn'),
sortable: true
}
sortable: true,
},
];
const messages = {
@ -83,15 +83,15 @@ const messages = {
).replace('%$1d', count.toLocaleString());
}
MailPoet.Notice.success(message);
}
},
};
const bulk_actions = [
{
name: 'trash',
label: MailPoet.I18n.t('moveToTrash'),
onSuccess: messages.onTrash
}
onSuccess: messages.onTrash,
},
];
const item_actions = [
@ -104,7 +104,7 @@ const item_actions = [
},
display: function (segment) {
return (segment.type !== 'wp_users');
}
},
},
{
name: 'duplicate_segment',
@ -115,8 +115,8 @@ const item_actions = [
endpoint: 'segments',
action: 'duplicate',
data: {
id: item.id
}
id: item.id,
},
}).done((response) => {
MailPoet.Notice.success(
MailPoet.I18n.t('listDuplicated').replace('%$1s', response.data.name)
@ -131,7 +131,7 @@ const item_actions = [
},
display: function (segment) {
return (segment.type !== 'wp_users');
}
},
},
{
name: 'read_more',
@ -145,7 +145,7 @@ const item_actions = [
},
display: function (segment) {
return (segment.type === 'wp_users');
}
},
},
{
name: 'synchronize_segment',
@ -155,7 +155,7 @@ const item_actions = [
MailPoet.Ajax.post({
api_version: window.mailpoet_api_version,
endpoint: 'segments',
action: 'synchronize'
action: 'synchronize',
}).done(() => {
MailPoet.Modal.loading(false);
MailPoet.Notice.success(
@ -174,7 +174,7 @@ const item_actions = [
},
display: function (segment) {
return (segment.type === 'wp_users');
}
},
},
{
name: 'view_subscribers',
@ -182,14 +182,14 @@ const item_actions = [
return (
<a href={ item.subscribers_url }>{MailPoet.I18n.t('viewSubscribers')}</a>
);
}
},
},
{
name: 'trash',
display: function (segment) {
return (segment.type !== 'wp_users');
}
}
},
},
];
const SegmentList = React.createClass({
@ -273,7 +273,7 @@ const SegmentList = React.createClass({
/>
</div>
);
}
},
});
module.exports = SegmentList;

View File

@ -11,7 +11,7 @@ const history = useRouterHistory(createHashHistory)({ queryKey: false });
const App = React.createClass({
render() {
return this.props.children;
}
},
});
const container = document.getElementById('segments_container');

View File

@ -17,7 +17,7 @@ define(
routes: {
'': 'sendingMethodGroup', // the default tab is currently mta, needs its own method
'mta(/:group)': 'sendingMethodGroup',
'(:tab)': 'tabs',
'(:tab)': 'tabs'
},
sendingMethodGroup: function(group) {
// display mta tab

View File

@ -4,7 +4,7 @@ define(
'react-router',
'mailpoet',
'form/form.jsx',
'react-string-replace'
'react-string-replace',
],
(
React,
@ -20,7 +20,7 @@ define(
type: 'text',
disabled: function (subscriber) {
return ~~(subscriber.wp_user_id > 0);
}
},
},
{
name: 'first_name',
@ -28,7 +28,7 @@ define(
type: 'text',
disabled: function (subscriber) {
return ~~(subscriber.wp_user_id > 0);
}
},
},
{
name: 'last_name',
@ -36,7 +36,7 @@ define(
type: 'text',
disabled: function (subscriber) {
return ~~(subscriber.wp_user_id > 0);
}
},
},
{
name: 'status',
@ -46,14 +46,14 @@ define(
'subscribed': MailPoet.I18n.t('subscribed'),
'unconfirmed': MailPoet.I18n.t('unconfirmed'),
'unsubscribed': MailPoet.I18n.t('unsubscribed'),
'bounced': MailPoet.I18n.t('bounced')
'bounced': MailPoet.I18n.t('bounced'),
},
filter: function (subscriber, value) {
if (~~(subscriber.wp_user_id) > 0 && value === 'unconfirmed') {
return false;
}
return true;
}
},
},
{
name: 'segments',
@ -103,8 +103,8 @@ define(
});
}
return label;
}
}
},
},
];
const custom_fields = window.mailpoet_custom_fields || [];
@ -112,7 +112,7 @@ define(
const field = {
name: 'cf_' + custom_field.id,
label: custom_field.name,
type: custom_field.type
type: custom_field.type,
};
if (custom_field.params) {
field.params = custom_field.params;
@ -144,7 +144,7 @@ define(
},
onCreate: function () {
MailPoet.Notice.success(MailPoet.I18n.t('subscriberAdded'));
}
},
};
const beforeFormContent = function (subscriber) {
@ -198,7 +198,7 @@ define(
/>
</div>
);
}
},
});
return SubscriberForm;

View File

@ -12,27 +12,27 @@ const columns = [
{
name: 'email',
label: MailPoet.I18n.t('subscriber'),
sortable: true
sortable: true,
},
{
name: 'status',
label: MailPoet.I18n.t('status'),
sortable: true
sortable: true,
},
{
name: 'segments',
label: MailPoet.I18n.t('lists')
label: MailPoet.I18n.t('lists'),
},
{
name: 'created_at',
label: MailPoet.I18n.t('subscribedOn'),
sortable: true
sortable: true,
},
{
name: 'updated_at',
label: MailPoet.I18n.t('lastModifiedOn'),
sortable: true
sortable: true,
},
];
@ -97,7 +97,7 @@ const messages = {
}
// use default message
return false;
}
},
};
const bulk_actions = [
@ -113,7 +113,7 @@ const bulk_actions = [
return !!(
!segment.deleted_at && segment.type === 'default'
);
}
},
};
return (
@ -122,7 +122,7 @@ const bulk_actions = [
},
getData: function () {
return {
segment_id: ~~(jQuery('#move_to_segment').val())
segment_id: ~~(jQuery('#move_to_segment').val()),
};
},
onSuccess: function (response) {
@ -131,7 +131,7 @@ const bulk_actions = [
.replace('%$1d', (~~(response.meta.count)).toLocaleString())
.replace('%$2s', response.meta.segment)
);
}
},
},
{
name: 'addToList',
@ -145,7 +145,7 @@ const bulk_actions = [
return !!(
!segment.deleted_at && segment.type === 'default'
);
}
},
};
return (
@ -154,7 +154,7 @@ const bulk_actions = [
},
getData: function () {
return {
segment_id: ~~(jQuery('#add_to_segment').val())
segment_id: ~~(jQuery('#add_to_segment').val()),
};
},
onSuccess: function (response) {
@ -163,7 +163,7 @@ const bulk_actions = [
.replace('%$1d', (~~response.meta.count).toLocaleString())
.replace('%$2s', response.meta.segment)
);
}
},
},
{
name: 'removeFromList',
@ -177,7 +177,7 @@ const bulk_actions = [
return !!(
segment.type === 'default'
);
}
},
};
return (
@ -186,7 +186,7 @@ const bulk_actions = [
},
getData: function () {
return {
segment_id: ~~(jQuery('#remove_from_segment').val())
segment_id: ~~(jQuery('#remove_from_segment').val()),
};
},
onSuccess: function (response) {
@ -195,7 +195,7 @@ const bulk_actions = [
.replace('%$1d', (~~response.meta.count).toLocaleString())
.replace('%$2s', response.meta.segment)
);
}
},
},
{
name: 'removeFromAllLists',
@ -205,7 +205,7 @@ const bulk_actions = [
MailPoet.I18n.t('multipleSubscribersRemovedFromAllLists')
.replace('%$1d', (~~response.meta.count).toLocaleString())
);
}
},
},
{
name: 'sendConfirmationEmail',
@ -215,13 +215,13 @@ const bulk_actions = [
MailPoet.I18n.t('multipleConfirmationEmailsSent')
.replace('%$1d', (~~response.meta.count).toLocaleString())
);
}
},
},
{
name: 'trash',
label: MailPoet.I18n.t('moveToTrash'),
onSuccess: messages.onTrash
}
onSuccess: messages.onTrash,
},
];
const item_actions = [
@ -232,14 +232,14 @@ const item_actions = [
return (
<Link to={ `/edit/${subscriber.id}` }>{MailPoet.I18n.t('edit')}</Link>
);
}
},
},
{
name: 'trash',
display: function (subscriber) {
return !!(~~subscriber.wp_user_id === 0);
}
}
},
},
];
const SubscriberList = React.createClass({
@ -364,7 +364,7 @@ const SubscriberList = React.createClass({
/>
</div>
);
}
},
});
module.exports = SubscriberList;

View File

@ -10,7 +10,7 @@ const history = useRouterHistory(createHashHistory)({ queryKey: false });
const App = React.createClass({
render() {
return this.props.children;
}
},
});
const container = document.getElementById('subscribers_container');

View File

@ -40,9 +40,9 @@ class Services extends APIEndpoint {
$state = !empty($result['state']) ? $result['state'] : null;
$success_message = null;
if($state == Bridge::MAILPOET_KEY_VALID) {
if($state == Bridge::PREMIUM_KEY_VALID) {
$success_message = __('Your MailPoet Sending Service key has been successfully validated.', 'mailpoet');
} elseif($state == Bridge::MAILPOET_KEY_EXPIRING) {
} elseif($state == Bridge::PREMIUM_KEY_EXPIRING) {
$success_message = sprintf(
__('Your MailPoet Sending Service key expires on %s!', 'mailpoet'),
$this->date_time->formatDate(strtotime($result['data']['expire_at']))
@ -54,7 +54,7 @@ class Services extends APIEndpoint {
}
switch($state) {
case Bridge::MAILPOET_KEY_INVALID:
case Bridge::PREMIUM_KEY_INVALID:
$error = __('Your MailPoet Sending Service key is invalid.', 'mailpoet');
break;
default:

View File

@ -5,6 +5,7 @@ use MailPoet\API;
use MailPoet\Cron\CronTrigger;
use MailPoet\Router;
use MailPoet\Util\ConflictResolver;
use MailPoet\Util\Helpers;
use MailPoet\WP\Notice as WPNotice;
if(!defined('ABSPATH')) exit;
@ -13,7 +14,8 @@ require_once(ABSPATH . 'wp-admin/includes/plugin.php');
class Initializer {
const UNABLE_TO_CONNECT = '<strong>Mailpoet:</strong> Unable to connect to the database (the database is unable to open a file or folder), the connection is likely not configured correctly. Please read our <a href="http://beta.docs.mailpoet.com/article/200-solving-database-connection-issues">Knowledge Base article</a> for steps how to resolve it.';
const UNABLE_TO_CONNECT = 'Unable to connect to the database (the database is unable to open a file or folder), the connection is likely not configured correctly. Please read our [link] Knowledge Base article [/link] for steps how to resolve it.';
const SOLVE_DB_ISSUE_URL = 'http://beta.docs.mailpoet.com/article/200-solving-database-connection-issues';
protected $plugin_initialized = false;
@ -36,7 +38,11 @@ class Initializer {
try {
$this->setupDB();
} catch(\Exception $e) {
return WPNotice::displayWarning(self::UNABLE_TO_CONNECT);
return WPNotice::displayError(Helpers::replaceLinkTags(
__(self::UNABLE_TO_CONNECT, 'mailpoet'),
self::SOLVE_DB_ISSUE_URL,
array('target' => '_blank')
));
}
// activation function

View File

@ -66,7 +66,7 @@ class Migrator {
function segments() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'name varchar(90) NOT NULL,',
'type varchar(90) NOT NULL DEFAULT "default",',
'description varchar(250) NOT NULL DEFAULT "",',
@ -81,7 +81,7 @@ class Migrator {
function settings() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'name varchar(50) NOT NULL,',
'value longtext,',
'created_at TIMESTAMP NULL,',
@ -94,7 +94,7 @@ class Migrator {
function customFields() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'name varchar(90) NOT NULL,',
'type varchar(90) NOT NULL,',
'params longtext NOT NULL,',
@ -108,7 +108,7 @@ class Migrator {
function scheduledTasks() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'type varchar(90) NULL DEFAULT NULL,',
'status varchar(12) NULL DEFAULT NULL,',
'priority mediumint(9) NOT NULL DEFAULT 0,',
@ -124,8 +124,8 @@ class Migrator {
function scheduledTaskSubscribers() {
$attributes = array(
'task_id mediumint(9) NOT NULL,',
'subscriber_id mediumint(9) NOT NULL,',
'task_id int(11) unsigned NOT NULL,',
'subscriber_id int(11) unsigned NOT NULL,',
'processed int(1) NOT NULL,',
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
'PRIMARY KEY (task_id, subscriber_id)',
@ -135,17 +135,17 @@ class Migrator {
function sendingQueues() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'type varchar(90) NULL DEFAULT NULL,',
'newsletter_id mediumint(9) NOT NULL,',
'newsletter_id int(11) unsigned NOT NULL,',
'newsletter_rendered_body longtext,',
'newsletter_rendered_subject varchar(250) NULL DEFAULT NULL,',
'subscribers longtext,',
'status varchar(12) NULL DEFAULT NULL,',
'priority mediumint(9) NOT NULL DEFAULT 0,',
'count_total mediumint(9) NOT NULL DEFAULT 0,',
'count_processed mediumint(9) NOT NULL DEFAULT 0,',
'count_to_process mediumint(9) NOT NULL DEFAULT 0,',
'count_total int(11) unsigned NOT NULL DEFAULT 0,',
'count_processed int(11) unsigned NOT NULL DEFAULT 0,',
'count_to_process int(11) unsigned NOT NULL DEFAULT 0,',
'scheduled_at TIMESTAMP NULL,',
'processed_at TIMESTAMP NULL,',
'created_at TIMESTAMP NULL,',
@ -158,7 +158,7 @@ class Migrator {
function subscribers() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'wp_user_id bigint(20) NULL,',
'first_name tinytext NOT NULL DEFAULT "",',
'last_name tinytext NOT NULL DEFAULT "",',
@ -179,9 +179,9 @@ class Migrator {
function subscriberSegment() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'subscriber_id mediumint(9) NOT NULL,',
'segment_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'subscriber_id int(11) unsigned NOT NULL,',
'segment_id int(11) unsigned NOT NULL,',
'status varchar(12) NOT NULL DEFAULT "' . Subscriber::STATUS_SUBSCRIBED . '",',
'created_at TIMESTAMP NULL,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
@ -193,9 +193,9 @@ class Migrator {
function subscriberCustomField() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'subscriber_id mediumint(9) NOT NULL,',
'custom_field_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'subscriber_id int(11) unsigned NOT NULL,',
'custom_field_id int(11) unsigned NOT NULL,',
'value varchar(255) NOT NULL DEFAULT "",',
'created_at TIMESTAMP NULL,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
@ -207,9 +207,9 @@ class Migrator {
function newsletters() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'hash varchar(150) NULL DEFAULT NULL,',
'parent_id mediumint(9) NULL,',
'parent_id int(11) unsigned NULL,',
'subject varchar(250) NOT NULL DEFAULT "",',
'type varchar(20) NOT NULL DEFAULT "standard",',
'sender_address varchar(150) NOT NULL DEFAULT "",',
@ -230,7 +230,7 @@ class Migrator {
function newsletterTemplates() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'name varchar(250) NOT NULL,',
'description varchar(250) NOT NULL,',
'body LONGTEXT,',
@ -245,7 +245,7 @@ class Migrator {
function newsletterOptionFields() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'name varchar(90) NOT NULL,',
'newsletter_type varchar(90) NOT NULL,',
'created_at TIMESTAMP NULL,',
@ -258,9 +258,9 @@ class Migrator {
function newsletterOption() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'newsletter_id mediumint(9) NOT NULL,',
'option_field_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'newsletter_id int(11) unsigned NOT NULL,',
'option_field_id int(11) unsigned NOT NULL,',
'value varchar(255) NOT NULL DEFAULT "",',
'created_at TIMESTAMP NULL,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
@ -272,9 +272,9 @@ class Migrator {
function newsletterSegment() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'newsletter_id mediumint(9) NOT NULL,',
'segment_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'newsletter_id int(11) unsigned NOT NULL,',
'segment_id int(11) unsigned NOT NULL,',
'created_at TIMESTAMP NULL,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),',
@ -285,9 +285,9 @@ class Migrator {
function newsletterLinks() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'newsletter_id mediumint(9) NOT NULL,',
'queue_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'newsletter_id int(11) unsigned NOT NULL,',
'queue_id int(11) unsigned NOT NULL,',
'url varchar(255) NOT NULL,',
'hash varchar(20) NOT NULL,',
'created_at TIMESTAMP NULL,',
@ -299,9 +299,9 @@ class Migrator {
function newsletterPosts() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'newsletter_id mediumint(9) NOT NULL,',
'post_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'newsletter_id int(11) unsigned NOT NULL,',
'post_id int(11) unsigned NOT NULL,',
'created_at TIMESTAMP NULL,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id)',
@ -311,7 +311,7 @@ class Migrator {
function forms() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'name varchar(90) NOT NULL,',
'body longtext,',
'settings longtext,',
@ -326,10 +326,10 @@ class Migrator {
function statisticsNewsletters() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'newsletter_id mediumint(9) NOT NULL,',
'subscriber_id mediumint(9) NOT NULL,',
'queue_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'newsletter_id int(11) unsigned NOT NULL,',
'subscriber_id int(11) unsigned NOT NULL,',
'queue_id int(11) unsigned NOT NULL,',
'sent_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),',
'KEY newsletter_id (newsletter_id)',
@ -339,12 +339,12 @@ class Migrator {
function statisticsClicks() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'newsletter_id mediumint(9) NOT NULL,',
'subscriber_id mediumint(9) NOT NULL,',
'queue_id mediumint(9) NOT NULL,',
'link_id mediumint(9) NOT NULL,',
'count mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'newsletter_id int(11) unsigned NOT NULL,',
'subscriber_id int(11) unsigned NOT NULL,',
'queue_id int(11) unsigned NOT NULL,',
'link_id int(11) unsigned NOT NULL,',
'count int(11) unsigned NOT NULL,',
'created_at TIMESTAMP NULL,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),',
@ -357,10 +357,10 @@ class Migrator {
function statisticsOpens() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'newsletter_id mediumint(9) NOT NULL,',
'subscriber_id mediumint(9) NOT NULL,',
'queue_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'newsletter_id int(11) unsigned NOT NULL,',
'subscriber_id int(11) unsigned NOT NULL,',
'queue_id int(11) unsigned NOT NULL,',
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),',
'KEY newsletter_id (newsletter_id),',
@ -372,10 +372,10 @@ class Migrator {
function statisticsUnsubscribes() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'newsletter_id mediumint(9) NOT NULL,',
'subscriber_id mediumint(9) NOT NULL,',
'queue_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'newsletter_id int(11) unsigned NOT NULL,',
'subscriber_id int(11) unsigned NOT NULL,',
'queue_id int(11) unsigned NOT NULL,',
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),',
'KEY newsletter_id (newsletter_id),',
@ -387,9 +387,9 @@ class Migrator {
function statisticsForms() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'form_id mediumint(9) NOT NULL,',
'subscriber_id mediumint(9) NOT NULL,',
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'form_id int(11) unsigned NOT NULL,',
'subscriber_id int(11) unsigned NOT NULL,',
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),',
'UNIQUE KEY form_subscriber (form_id,subscriber_id)'
@ -399,9 +399,9 @@ class Migrator {
function mappingToExternalEntities() {
$attributes = array(
'old_id mediumint(9) NOT NULL,',
'old_id int(11) unsigned NOT NULL,',
'type varchar(50) NOT NULL,',
'new_id mediumint(9) NOT NULL,',
'new_id int(11) unsigned NOT NULL,',
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
'PRIMARY KEY (old_id, type),',
'KEY new_id (new_id)'

View File

@ -22,7 +22,7 @@ class ServicesChecker {
if(!$mss_key_specified
|| empty($mss_key['state'])
|| $mss_key['state'] == Bridge::MAILPOET_KEY_INVALID
|| $mss_key['state'] == Bridge::PREMIUM_KEY_INVALID
) {
if($display_error_notice) {
$error = Helpers::replaceLinkTags(
@ -33,7 +33,7 @@ class ServicesChecker {
WPNotice::displayError($error);
}
return false;
} elseif($mss_key['state'] == Bridge::MAILPOET_KEY_EXPIRING
} elseif($mss_key['state'] == Bridge::PREMIUM_KEY_EXPIRING
&& !empty($mss_key['data']['expire_at'])
) {
if($display_error_notice) {
@ -48,7 +48,7 @@ class ServicesChecker {
WPNotice::displayWarning($error);
}
return true;
} elseif($mss_key['state'] == Bridge::MAILPOET_KEY_VALID) {
} elseif($mss_key['state'] == Bridge::PREMIUM_KEY_VALID) {
return true;
}

View File

@ -94,7 +94,13 @@ class Newsletter {
// extract and save newsletter posts
PostsTask::extractAndSave($rendered_newsletter, $newsletter);
// update queue with the rendered and pre-processed newsletter
$queue->newsletter_rendered_subject = Shortcodes::process($newsletter->subject, $newsletter, null, $queue);
$queue->newsletter_rendered_subject = ShortcodesTask::process(
$newsletter->subject,
$rendered_newsletter['html'],
$newsletter,
null,
$queue
);
$queue->newsletter_rendered_body = $rendered_newsletter;
$queue->save();
// catch DB errors
@ -123,6 +129,7 @@ class Newsletter {
);
$prepared_newsletter = ShortcodesTask::process(
$prepared_newsletter,
null,
$newsletter,
$subscriber,
$queue

View File

@ -1,4 +1,5 @@
<?php
namespace MailPoet\Cron\Workers\SendingQueue\Tasks;
use MailPoet\Newsletter\Shortcodes\Shortcodes as NewsletterShortcodes;
@ -6,8 +7,8 @@ use MailPoet\Newsletter\Shortcodes\Shortcodes as NewsletterShortcodes;
if(!defined('ABSPATH')) exit;
class Shortcodes {
static function process($content, $newsletter, $subscriber, $queue) {
static function process($content, $content_source = null, $newsletter = null, $subscriber = null, $queue = null) {
$shortcodes = new NewsletterShortcodes($newsletter, $subscriber, $queue);
return $shortcodes->replace($content);
return $shortcodes->replace($content, $content_source);
}
}

View File

@ -79,7 +79,7 @@ class Date extends Base {
$html .= '</select>';
} else if($date_selector === 'MM') {
$block['selected'] = $month;
$html .= '<select class="mailpoet_date_month" ';
$html .= '<select class="mailpoet_select mailpoet_date_month" ';
$html .= static::getInputValidation($block, array(
'required-message' => __('Please select a month', 'mailpoet')
));

View File

@ -8,7 +8,7 @@ class Submit extends Base {
static function render($block) {
$html = '';
$html .= '<p class="mailpoet_submit"><input type="submit" ';
$html .= '<p class="mailpoet_paragraph"><input type="submit" class="mailpoet_submit" ';
$html .= 'value="'.static::getFieldLabel($block).'" ';

View File

@ -13,10 +13,11 @@ class Styles {
/* paragraphs (label + input) */
.mailpoet_paragraph {
line-height:20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
@ -25,18 +26,35 @@ class Styles {
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight:bold;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_checkbox {
.mailpoet_text,
.mailpoet_textarea {
width:200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit input {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_validate_success {

View File

@ -458,42 +458,33 @@ class Newsletter extends Model {
}
function getStatistics() {
if($this->type === self::TYPE_WELCOME) {
$where = '`queue_id` IN (SELECT `id` FROM ' . MP_SENDING_QUEUES_TABLE . '
WHERE `newsletter_id` = ? AND `status` = ?)';
$where_params = array($this->id, SendingQueue::STATUS_COMPLETED);
} else {
if($this->queue === false) {
return false;
} else {
$where = '`queue_id` = ?';
$where_params = array($this->queue['id']);
}
if(($this->type !== self::TYPE_WELCOME) && ($this->queue === false)) {
return false;
}
$clicks = StatisticsClicks::selectExpr(
'COUNT(DISTINCT subscriber_id) as cnt'
)
->whereRaw($where, $where_params)
->findOne();
$opens = StatisticsOpens::selectExpr(
'COUNT(DISTINCT subscriber_id) as cnt'
)
->whereRaw($where, $where_params)
->findOne();
$unsubscribes = StatisticsUnsubscribes::selectExpr(
'COUNT(DISTINCT subscriber_id) as cnt'
)
->whereRaw($where, $where_params)
->findOne();
return array(
'clicked' => !empty($clicks->cnt) ? $clicks->cnt : 0,
'opened' => !empty($opens->cnt) ? $opens->cnt : 0,
'unsubscribed' => !empty($unsubscribes->cnt) ? $unsubscribes->cnt : 0
$statisticsExprs = array(
'clicked' => StatisticsClicks::selectExpr('COUNT(DISTINCT subscriber_id) as cnt')->tableAlias("stat"),
'opened' => StatisticsOpens::selectExpr('COUNT(DISTINCT subscriber_id) as cnt')->tableAlias("stat"),
'unsubscribed' => StatisticsUnsubscribes::selectExpr('COUNT(DISTINCT subscriber_id) as cnt')->tableAlias("stat"),
);
$result = array();
foreach($statisticsExprs as $name => $statisticsExpr) {
if($this->type !== self::TYPE_WELCOME) {
$row = $statisticsExpr->whereRaw('`queue_id` = ?', array($this->queue['id']))->findOne();
} else {
$row = $statisticsExpr
->join(MP_SENDING_QUEUES_TABLE, array("queue_id", "=", "qt.id"), "qt")
->where(array(
"qt.status" => SendingQueue::STATUS_COMPLETED,
"stat.newsletter_id" => $this->id,
))->findOne();
}
$result[$name] = !empty($row->cnt) ? $row->cnt : 0;
}
return $result;
}
static function getAnalytics() {

View File

@ -40,10 +40,11 @@ class PostContentManager {
// strip useless tags
$tags_not_being_stripped = array(
'<img>', '<p>', '<em>', '<span>', '<b>', '<strong>', '<i>', '<h1>',
'<h2>', '<h3>', '<a>', '<ul>', '<ol>', '<li>', '<br>'
'<h2>', '<h3>', '<a>', '<ul>', '<ol>', '<li>', '<br>', '<blockquote>'
);
$content = strip_tags($content, implode('', $tags_not_being_stripped));
$content = str_replace('<p', '<p class="' . self::WP_POST_CLASS .'"', wpautop($content));
$content = trim($content);
return $content;
}
@ -92,4 +93,4 @@ class PostContentManager {
return $content;
}
}
}

View File

@ -2,6 +2,7 @@
namespace MailPoet\Newsletter\Editor;
use pQuery;
use MailPoet\Util\DOM as DOMUtil;
if(!defined('ABSPATH')) exit;
@ -17,29 +18,22 @@ class StructureTransformer {
}
/**
* Hoists images to root level, preserves order
* and inserts tags before top ancestor
* Hoists images to root level, preserves order by splitting neighboring
* elements and inserts tags as children of top ancestor
*/
private function hoistImagesToRoot($root) {
protected function hoistImagesToRoot($root) {
foreach($root->query('img') as $item) {
$top_ancestor = $this->findTopAncestor($item);
$top_ancestor = DOMUtil::findTopAncestor($item);
$offset = $top_ancestor->index();
if($item->hasParent('a')) {
$item = $item->parent;
}
$item->changeParent($root, $offset);
DOMUtil::splitOn($item->getRoot(), $item);
}
}
private static function findTopAncestor($item) {
while($item->parent->parent !== null) {
$item = $item->parent;
}
return $item;
}
/**
* Transforms HTML tags into their respective JSON objects,
* turns other root children into text blocks

View File

@ -11,7 +11,6 @@ class Renderer {
$this->getOneColumnTemplate($styles, $class) :
$this->getMultipleColumnsTemplate($styles, $width, $alignment, $class);
$result = array_map(function($content) use ($template) {
$content = Renderer::removePaddingFromLastElement($content);
return $template['content_start'] . $content . $template['content_end'];
}, $columns_data);
$result = implode('', $result);
@ -79,10 +78,6 @@ class Renderer {
return $template;
}
function removePaddingFromLastElement($element) {
return preg_replace('/mailpoet_padded_bottom(?!.*mailpoet_padded_bottom)/ism', '', $element);
}
function getBackgroundColor($styles) {
if(!isset($styles['backgroundColor'])) return false;
$background_color = $styles['backgroundColor'];

View File

@ -1,4 +1,5 @@
<?php
namespace MailPoet\Newsletter\Shortcodes\Categories;
use MailPoet\Models\Newsletter as NewsletterModel;
@ -25,7 +26,7 @@ class Newsletter {
case 'post_title':
preg_match_all('/data-post-id="(\d+)"/ism', $content, $posts);
$post_ids = array_unique($posts[1]);
$latest_post = self::getLatestWPPost($post_ids);
$latest_post = (!empty($post_ids)) ? self::getLatestWPPost($post_ids) : false;
return ($latest_post) ? $latest_post['post_title'] : false;
case 'number':
@ -44,6 +45,7 @@ class Newsletter {
private static function getLatestWPPost($post_ids) {
$posts = new \WP_Query(
array(
'post_type' => get_post_types(),
'post__in' => $post_ids,
'posts_per_page' => 1,
'ignore_sticky_posts' => true,

View File

@ -91,12 +91,18 @@ class Shortcodes {
return $processed_shortcodes;
}
function replace($content, $categories = false) {
function replace($content, $content_source = null, $categories = null) {
$shortcodes = $this->extract($content, $categories);
if(!$shortcodes) {
return $content;
}
$processed_shortcodes = $this->process($shortcodes, $content);
// if content contains only shortcodes (e.g., [newsletter:post_title]) but their processing
// depends on some other content (e.g., "post_id" inside a rendered newsletter),
// then we should use that content source when processing shortcodes
$processed_shortcodes = $this->process(
$shortcodes,
($content_source) ? $content_source : $content
);
$shortcodes = array_intersect_key($shortcodes, $processed_shortcodes);
return str_replace($shortcodes, $processed_shortcodes, $content);
}

View File

@ -14,12 +14,6 @@ class Bridge {
const PREMIUM_KEY_SETTING_NAME = 'premium.premium_key';
const PREMIUM_KEY_STATE_SETTING_NAME = 'premium.premium_key_state';
const MAILPOET_KEY_VALID = 'valid';
const MAILPOET_KEY_INVALID = 'invalid';
const MAILPOET_KEY_EXPIRING = 'expiring';
const MAILPOET_KEY_CHECK_ERROR = 'check_error';
const PREMIUM_KEY_VALID = 'valid';
const PREMIUM_KEY_INVALID = 'invalid';
const PREMIUM_KEY_EXPIRING = 'expiring';
@ -63,31 +57,12 @@ class Bridge {
function checkMSSKey($api_key) {
$this->initApi($api_key);
$result = $this->api->checkMSSKey();
return $this->processMSSKeyCheckResult($result);
}
private function processMSSKeyCheckResult(array $result) {
$state_map = array(
200 => self::MAILPOET_KEY_VALID,
401 => self::MAILPOET_KEY_INVALID,
402 => self::MAILPOET_KEY_EXPIRING
);
if(!empty($result['code']) && isset($state_map[$result['code']])) {
$key_state = $state_map[$result['code']];
} else {
$key_state = self::MAILPOET_KEY_CHECK_ERROR;
}
return $this->buildKeyState(
$key_state,
$result
);
return $this->processPremiumKeyCheckResult($result);
}
function storeMSSKeyAndState($key, $state) {
if(empty($state['state'])
|| $state['state'] === self::MAILPOET_KEY_CHECK_ERROR
|| $state['state'] === self::PREMIUM_KEY_CHECK_ERROR
) {
return false;
}
@ -168,8 +143,8 @@ class Bridge {
function updateSubscriberCount($result) {
if(!empty($result['state'])
&& ($result['state'] === self::MAILPOET_KEY_VALID
|| $result['state'] === self::MAILPOET_KEY_EXPIRING)
&& ($result['state'] === self::PREMIUM_KEY_VALID
|| $result['state'] === self::PREMIUM_KEY_EXPIRING)
) {
return $this->api->updateSubscriberCount(Subscriber::getTotalSubscribers());
}
@ -179,7 +154,7 @@ class Bridge {
static function invalidateKey() {
Setting::setValue(
self::API_KEY_STATE_SETTING_NAME,
array('state' => self::MAILPOET_KEY_INVALID)
array('state' => self::PREMIUM_KEY_INVALID)
);
}

Some files were not shown because too many files have changed in this diff Show More