Compare commits

...

29 Commits

Author SHA1 Message Date
580ac989aa Bump up version to 0.0.17 2016-02-19 15:35:27 +02:00
acf300160d Merge pull request #356 from mailpoet/page_reviews
Page reviews
2016-02-18 15:34:10 +02:00
983df4ee13 Merge pull request #355 from mailpoet/editor_polishing_3
Editor polishing 3
2016-02-18 07:45:20 -05:00
03c782d4ab Fixed issue #305
- added validation on add/edit Custom Field for multiple values (select/radio)
- disabled Remove link when only one value remains
- Added confirmation message on Reinstall
- Added missing period in Import
2016-02-18 13:14:57 +01:00
0daf7e12c1 remove logging function (polluting unit tests) & bugfix on model subscriber addToSegments 2016-02-18 13:13:19 +01:00
6a2e18a0e1 fix segments being reset on Subscriber::createOrUpdate() 2016-02-18 13:13:19 +01:00
316d5ab183 fixed unit tests 2016-02-18 13:13:19 +01:00
eb6bba5961 Merge pull request #351 from mailpoet/import_language_update
Updates error messages displayed during import
2016-02-18 09:55:59 +01:00
b5864adf06 - Fixes writable path check 2016-02-17 11:47:20 -05:00
9bce50a633 Fix "Full width" image option 2016-02-17 15:10:51 +02:00
365a53cf27 Merge pull request #353 from mailpoet/subscribers_page_review
Subscribers page review
2016-02-17 14:28:36 +02:00
31a4575d43 replaced closure by callbacks 2016-02-17 13:02:35 +01:00
1ae584c4e7 Restyle ALC Post number/type selector, limit to 2 character input 2016-02-17 13:29:16 +02:00
aac2cd6eb8 Add button "Bold" text option, fix unit tests 2016-02-17 12:25:03 +02:00
9874e1c371 Remove 1px left black border from newsletter thumbnails 2016-02-17 12:25:03 +02:00
16b1c0dc41 Convert mailpoet buttons to WP buttons in newsletter editor 2016-02-17 12:25:03 +02:00
9223fbf478 Display loading animation when listing newsletter templates 2016-02-17 12:25:03 +02:00
eb27de36f4 Select active block format and allow custom colors in TinyMCe 2016-02-17 12:25:03 +02:00
636fa38ab6 - Enables check for writable export file 2016-02-16 17:35:20 -05:00
9b1503dc7a Fixed reported issues + refactoring
- refactored Config/Hooks to make it more readable
- added hook to save limit per page
- added default limit per page as a constant in Listing/Handler
2016-02-16 16:33:20 +01:00
2ac3b00af6 Merge pull request #354 from mailpoet/parsley_firefox_fix
fixed parsley issue with firefox
2016-02-16 12:32:29 +02:00
5fcdbfe826 fixed parsley issue with firefox 2016-02-15 21:19:21 +01:00
67036ddb61 cleanup and bugfix on bulk actions 2016-02-15 15:50:47 +01:00
6c0f6a07cd removed useless constant 2016-02-15 15:40:21 +01:00
8139a7dd0a Subscribers page review
- added screen option to set number of items per page
- improved bulk actions in order to handle large sets
2016-02-15 15:40:21 +01:00
97adfc14c0 Bump up version to 0.0.16 2016-02-15 14:50:13 +02:00
4ed703a351 Merge pull request #352 from mailpoet/exception_fix
Fixes remaining exception namescape issues
2016-02-15 13:39:18 +02:00
2aee853406 - Fixes remaining exception namescape issues 2016-02-13 21:39:55 -05:00
854736fac7 - Updates error messages 2016-02-12 14:12:14 -05:00
65 changed files with 617 additions and 301 deletions

View File

@ -38,9 +38,7 @@
content: '\f142'
.mailpoet_save_show_options_icon
width: auto
height: auto
line-height: auto
vertical-align: middle
&::before
content: '\f140'

View File

@ -21,3 +21,9 @@
.mailpoet_automated_latest_content_display_options
animation-slide-open-downwards()
.mailpoet_automated_latest_content_show_amount
width: 25px
.mailpoet_automated_latest_content_content_type
width: 180px

View File

@ -11,9 +11,6 @@
padding-right: 0
margin-bottom: 0
img
width: 100%
.mailpoet_content a:hover
cursor: all-scroll

View File

@ -133,3 +133,17 @@ body
.wrap > .mailpoet_notice,
.update-nag
margin-left: 2px + 15px !important
/* Make a button group */
.mailpoet_button_group
.button:first-child
border-right: 0
border-top-right-radius: 0
border-bottom-right-radius: 0
.button:last-child
border-left: 0
border-top-left-radius: 0
border-bottom-left-radius: 0

View File

@ -10,10 +10,13 @@ function(
return this.props.onValueChange(e);
},
render: function() {
const isChecked = !!(this.props.item[this.props.field.name]);
if (this.props.field.values === undefined) {
return false;
}
const isChecked = !!(this.props.item[this.props.field.name]);
const options = Object.keys(this.props.field.values).map(
function(value, index) {
(value, index) => {
return (
<p key={ 'checkbox-' + index }>
<label>
@ -29,7 +32,7 @@ function(
</label>
</p>
);
}.bind(this)
}
);
return (

View File

@ -4,12 +4,15 @@ define([
function(
React
) {
var FormFieldRadio = React.createClass({
const FormFieldRadio = React.createClass({
render: function() {
var selected_value = this.props.item[this.props.field.name];
if (this.props.field.values === undefined) {
return false;
}
var options = Object.keys(this.props.field.values).map(
function(value, index) {
const selected_value = this.props.item[this.props.field.name];
const options = Object.keys(this.props.field.values).map(
(value, index) => {
return (
<p key={ 'radio-' + index }>
<label>
@ -23,7 +26,7 @@ function(
</label>
</p>
);
}.bind(this)
}
);
return (

View File

@ -4,10 +4,14 @@ define([
function(
React
) {
var FormFieldSelect = React.createClass({
const FormFieldSelect = React.createClass({
render: function() {
var options =
Object.keys(this.props.field.values).map(function(value, index) {
if (this.props.field.values === undefined) {
return false;
}
const options = Object.keys(this.props.field.values).map(
(value, index) => {
return (
<option
key={ 'option-' + index }
@ -15,7 +19,7 @@ function(
{ this.props.field.values[value] }
</option>
);
}.bind(this)
}
);
return (

View File

@ -32,6 +32,7 @@ define([
fontColor: '#000000',
fontFamily: 'Arial',
fontSize: '16px',
fontWeight: 'normal', // 'normal'|'bold'
textAlign: 'center',
},
},
@ -72,6 +73,7 @@ define([
"change .mailpoet_field_button_font_size": _.partial(this.changeField, "styles.block.fontSize"),
"change .mailpoet_field_button_background_color": _.partial(this.changeColorField, "styles.block.backgroundColor"),
"change .mailpoet_field_button_border_color": _.partial(this.changeColorField, "styles.block.borderColor"),
"change .mailpoet_field_button_font_weight": "changeFontWeight",
"input .mailpoet_field_button_border_width": _.partial(this.updateValueAndCall, '.mailpoet_field_button_border_width_input', _.partial(this.changePixelField, "styles.block.borderWidth").bind(this)),
"change .mailpoet_field_button_border_width": _.partial(this.updateValueAndCall, '.mailpoet_field_button_border_width_input', _.partial(this.changePixelField, "styles.block.borderWidth").bind(this)),
@ -128,6 +130,13 @@ define([
this.$(fieldToUpdate).val(jQuery(event.target).val());
callable(event);
},
changeFontWeight: function(event) {
var checked = !!jQuery(event.target).prop('checked');
this.model.set(
'styles.block.fontWeight',
(checked) ? jQuery(event.target).val() : 'normal'
);
}
});
Module.ButtonWidgetView = base.WidgetView.extend({

View File

@ -60,11 +60,9 @@ define([
valid_elements: "p[class|style],span[class|style],a[href|class|title|target|style],strong[class|style],em[class|style],strike,br",
invalid_elements: "script",
style_formats: [
{title: 'Paragraph', block: 'p'},
],
block_formats: 'Paragraph=p',
plugins: "link textcolor mailpoet_custom_fields",
plugins: "link textcolor colorpicker mailpoet_custom_fields",
setup: function(editor) {
editor.on('change', function(e) {

View File

@ -60,11 +60,9 @@ define([
valid_elements: "p[class|style],span[class|style],a[href|class|title|target|style],strong[class|style],em[class|style],strike,br",
invalid_elements: "script",
style_formats: [
{title: 'Paragraph', block: 'p'},
],
block_formats: 'Paragraph=p',
plugins: "link textcolor mailpoet_custom_fields",
plugins: "link textcolor colorpicker mailpoet_custom_fields",
setup: function(editor) {
editor.on('change', function(e) {

View File

@ -111,7 +111,7 @@ define([
data.posts = this.get('_selectedPosts').pluck('ID');
if (data.posts.length === 0) {
this.get('_transformedPosts.blocks').reset();
this.get('_transformedPosts').get('blocks').reset();
return;
}

View File

@ -52,21 +52,15 @@ define([
inline: true,
menubar: false,
toolbar1: "styleselect bold italic forecolor | link unlink",
toolbar1: "formatselect bold italic forecolor | link unlink",
toolbar2: "alignleft aligncenter alignright alignjustify | bullist numlist blockquote | code mailpoet_custom_fields",
//forced_root_block: 'p',
valid_elements: "p[class|style],span[class|style],a[href|class|title|target|style],h1[class|style],h2[class|style],h3[class|style],ol[class|style],ul[class|style],li[class|style],strong[class|style],em[class|style],strike,br,blockquote[class|style],table[class|style],tr[class|style],th[class|style],td[class|style]",
invalid_elements: "script",
style_formats: [
{title: 'Heading 1', block: 'h1'},
{title: 'Heading 2', block: 'h2'},
{title: 'Heading 3', block: 'h3'},
block_formats: 'Heading 1=h1;Heading 2=h2;Heading 3=h3;Paragraph=p',
{title: 'Paragraph', block: 'p'},
],
plugins: "link code textcolor mailpoet_custom_fields",
plugins: "link code textcolor colorpicker mailpoet_custom_fields",
setup: function(editor) {
editor.on('change', function(e) {

View File

@ -67,7 +67,28 @@ define([
};
Module.getThumbnail = function(element, options) {
return html2canvas(element, options || {});
var promise = html2canvas(element, options || {});
return promise.then(function(oldCanvas) {
// Temporary workaround for html2canvas-alpha2.
// Removes 1px left transparent border from resulting canvas.
var oldContext = oldCanvas.getContext('2d'),
newCanvas = document.createElement("canvas"),
newContext = newCanvas.getContext("2d"),
leftBorderWidth = 1;
newCanvas.width = oldCanvas.width;
newCanvas.height = oldCanvas.height;
newContext.drawImage(
oldCanvas,
leftBorderWidth, 0, oldCanvas.width - leftBorderWidth, oldCanvas.height,
0, 0, oldCanvas.width, oldCanvas.height
);
return newCanvas;
});
};
Module.saveTemplate = function(options) {

View File

@ -26,7 +26,8 @@ define(
"Tempt them to open your email.",
type: 'text',
validation: {
'data-parsley-required': true
'data-parsley-required': true,
'data-parsley-required-message': 'You need to specify a subject.'
}
},
{
@ -42,7 +43,8 @@ define(
return !!(!segment.deleted_at);
},
validation: {
'data-parsley-required': true
'data-parsley-required': true,
'data-parsley-required-message': 'You need to select a segment.'
}
},
{
@ -107,8 +109,16 @@ define(
mixins: [
Router.History
],
componentDidMount: function() {
jQuery('#mailpoet_newsletter').parsley();
},
isValid: function() {
return jQuery('#mailpoet_newsletter').parsley().isValid();
},
handleSend: function() {
if(jQuery('#mailpoet_newsletter').parsley().validate() === true) {
if(!this.isValid()) {
jQuery('#mailpoet_newsletter').parsley().validate();
} else {
MailPoet.Ajax.post({
endpoint: 'sendingQueue',
action: 'add',
@ -132,9 +142,7 @@ define(
);
} else {
if(response.errors) {
MailPoet.Notice.error(
response.errors.join("<br />")
);
MailPoet.Notice.error(response.errors);
} else {
MailPoet.Notice.error(
'An error occurred while trying to send. '+
@ -144,6 +152,7 @@ define(
}
}.bind(this));
}
return false;
},
render: function() {
return (
@ -158,6 +167,7 @@ define(
fields={ fields }
params={ this.props.params }
messages={ messages }
isValid={ this.isValid }
>
<p className="submit">
<input

View File

@ -24,11 +24,14 @@ define(
template.body = JSON.stringify(template.body);
}
MailPoet.Modal.loading(true);
MailPoet.Ajax.post({
endpoint: 'newsletterTemplates',
action: 'save',
data: template
}).done(function(response) {
MailPoet.Modal.loading(false);
if(response.result === true) {
this.props.onImport(template);
} else {
@ -92,10 +95,13 @@ define(
getTemplates: function() {
this.setState({ loading: true });
MailPoet.Modal.loading(true);
MailPoet.Ajax.post({
endpoint: 'newsletterTemplates',
action: 'getAll',
}).done(function(response) {
MailPoet.Modal.loading(false);
if(this.isMounted()) {
if(response.length === 0) {

View File

@ -148,7 +148,7 @@ define(
.done(function (response) {
MailPoet.Modal.loading(false);
if (response.result === false) {
MailPoet.Notice.error(response.error);
MailPoet.Notice.error(response.errors);
} else {
resultMessage = MailPoetI18n.exportMessage
.replace('%1$s', '<strong>' + response.data.totalExported + '</strong>')

View File

@ -313,6 +313,7 @@ const SubscriberList = React.createClass({
</h2>
<Listing
limit={ mailpoet_listing_per_page }
location={ this.props.location }
params={ this.props.params }
endpoint="subscribers"

144
composer.lock generated
View File

@ -160,23 +160,23 @@
},
{
"name": "mtdowling/cron-expression",
"version": "v1.0.4",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/mtdowling/cron-expression.git",
"reference": "fd92e883195e5dfa77720b1868cf084b08be4412"
"reference": "c9ee7886f5a12902b225a1a12f36bb45f9ab89e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/fd92e883195e5dfa77720b1868cf084b08be4412",
"reference": "fd92e883195e5dfa77720b1868cf084b08be4412",
"url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/c9ee7886f5a12902b225a1a12f36bb45f9ab89e5",
"reference": "c9ee7886f5a12902b225a1a12f36bb45f9ab89e5",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "4.*"
"phpunit/phpunit": "~4.0|~5.0"
},
"type": "library",
"autoload": {
@ -200,7 +200,7 @@
"cron",
"schedule"
],
"time": "2015-01-11 23:07:46"
"time": "2016-01-26 21:23:30"
},
{
"name": "nesbot/carbon",
@ -547,16 +547,16 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.0.1",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25"
"reference": "1289d16209491b584839022f29257ad859b8532d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/49ff736bd5d41f45240cec77b44967d76e0c3d25",
"reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d",
"reference": "1289d16209491b584839022f29257ad859b8532d",
"shasum": ""
},
"require": {
@ -568,7 +568,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "1.1-dev"
}
},
"autoload": {
@ -602,7 +602,7 @@
"portable",
"shim"
],
"time": "2015-11-20 09:19:13"
"time": "2016-01-20 09:13:37"
},
{
"name": "symfony/translation",
@ -722,16 +722,16 @@
},
{
"name": "twig/twig",
"version": "v1.23.3",
"version": "v1.24.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "ae53fc2c312fdee63773b75cb570304f85388b08"
"reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/ae53fc2c312fdee63773b75cb570304f85388b08",
"reference": "ae53fc2c312fdee63773b75cb570304f85388b08",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8",
"reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8",
"shasum": ""
},
"require": {
@ -744,7 +744,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.23-dev"
"dev-master": "1.24-dev"
}
},
"autoload": {
@ -779,22 +779,22 @@
"keywords": [
"templating"
],
"time": "2016-01-11 14:02:19"
"time": "2016-01-25 21:22:18"
}
],
"packages-dev": [
{
"name": "codeception/codeception",
"version": "2.1.5",
"version": "2.1.6",
"source": {
"type": "git",
"url": "https://github.com/Codeception/Codeception.git",
"reference": "4ee562f421fd404139dd7b73ae46d075396a4baf"
"reference": "b199941f5e59d1e7fd32d78296c8ab98db873d89"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Codeception/Codeception/zipball/4ee562f421fd404139dd7b73ae46d075396a4baf",
"reference": "4ee562f421fd404139dd7b73ae46d075396a4baf",
"url": "https://api.github.com/repos/Codeception/Codeception/zipball/b199941f5e59d1e7fd32d78296c8ab98db873d89",
"reference": "b199941f5e59d1e7fd32d78296c8ab98db873d89",
"shasum": ""
},
"require": {
@ -861,7 +861,7 @@
"functional testing",
"unit testing"
],
"time": "2015-12-20 12:11:42"
"time": "2016-02-09 22:27:48"
},
{
"name": "codeception/verify",
@ -1328,22 +1328,24 @@
},
{
"name": "phpspec/prophecy",
"version": "v1.5.0",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7"
"reference": "3c91bdf81797d725b14cb62906f9a4ce44235972"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7",
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972",
"reference": "3c91bdf81797d725b14cb62906f9a4ce44235972",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "~2.0",
"sebastian/comparator": "~1.1"
"sebastian/comparator": "~1.1",
"sebastian/recursion-context": "~1.0"
},
"require-dev": {
"phpspec/phpspec": "~2.0"
@ -1351,7 +1353,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
"dev-master": "1.5.x-dev"
}
},
"autoload": {
@ -1384,7 +1386,7 @@
"spy",
"stub"
],
"time": "2015-08-13 10:07:40"
"time": "2016-02-15 07:46:21"
},
{
"name": "phpunit/php-code-coverage",
@ -1628,16 +1630,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.8.21",
"version": "4.8.23",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "ea76b17bced0500a28098626b84eda12dbcf119c"
"reference": "6e351261f9cd33daf205a131a1ba61c6d33bd483"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea76b17bced0500a28098626b84eda12dbcf119c",
"reference": "ea76b17bced0500a28098626b84eda12dbcf119c",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6e351261f9cd33daf205a131a1ba61c6d33bd483",
"reference": "6e351261f9cd33daf205a131a1ba61c6d33bd483",
"shasum": ""
},
"require": {
@ -1696,7 +1698,7 @@
"testing",
"xunit"
],
"time": "2015-12-12 07:45:58"
"time": "2016-02-11 14:56:33"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -2227,16 +2229,16 @@
},
{
"name": "symfony/browser-kit",
"version": "v3.0.1",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
"reference": "334a58c0def6dfcbe4bb57c6d2a8c06c6cc77679"
"reference": "dde849a0485b70a24b36f826ed3fb95b904d80c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/334a58c0def6dfcbe4bb57c6d2a8c06c6cc77679",
"reference": "334a58c0def6dfcbe4bb57c6d2a8c06c6cc77679",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/dde849a0485b70a24b36f826ed3fb95b904d80c3",
"reference": "dde849a0485b70a24b36f826ed3fb95b904d80c3",
"shasum": ""
},
"require": {
@ -2280,7 +2282,7 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
"time": "2015-12-26 13:39:53"
"time": "2016-01-27 11:34:55"
},
{
"name": "symfony/config",
@ -2394,16 +2396,16 @@
},
{
"name": "symfony/css-selector",
"version": "v3.0.1",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "4613311fd46e146f506403ce2f8a0c71d402d2a3"
"reference": "6605602690578496091ac20ec7a5cbd160d4dff4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/4613311fd46e146f506403ce2f8a0c71d402d2a3",
"reference": "4613311fd46e146f506403ce2f8a0c71d402d2a3",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/6605602690578496091ac20ec7a5cbd160d4dff4",
"reference": "6605602690578496091ac20ec7a5cbd160d4dff4",
"shasum": ""
},
"require": {
@ -2443,20 +2445,20 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2015-12-05 17:45:07"
"time": "2016-01-27 05:14:46"
},
{
"name": "symfony/dom-crawler",
"version": "v3.0.1",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "7c622b0c9fb8bdb146d6dfa86c5f91dcbfdbc11d"
"reference": "b693a9650aa004576b593ff2e91ae749dc90123d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/7c622b0c9fb8bdb146d6dfa86c5f91dcbfdbc11d",
"reference": "7c622b0c9fb8bdb146d6dfa86c5f91dcbfdbc11d",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b693a9650aa004576b593ff2e91ae749dc90123d",
"reference": "b693a9650aa004576b593ff2e91ae749dc90123d",
"shasum": ""
},
"require": {
@ -2499,7 +2501,7 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"time": "2015-12-26 13:42:31"
"time": "2016-01-25 09:56:57"
},
{
"name": "symfony/event-dispatcher",
@ -2735,16 +2737,16 @@
},
{
"name": "symfony/intl",
"version": "v3.0.1",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/intl.git",
"reference": "9abd5cd590211c35cda87591f0dee856b7a16125"
"reference": "7fa23b8f2ddd96260f0154946b69eb0f2c2ce7bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/intl/zipball/9abd5cd590211c35cda87591f0dee856b7a16125",
"reference": "9abd5cd590211c35cda87591f0dee856b7a16125",
"url": "https://api.github.com/repos/symfony/intl/zipball/7fa23b8f2ddd96260f0154946b69eb0f2c2ce7bc",
"reference": "7fa23b8f2ddd96260f0154946b69eb0f2c2ce7bc",
"shasum": ""
},
"require": {
@ -2806,7 +2808,7 @@
"l10n",
"localization"
],
"time": "2015-12-05 11:13:14"
"time": "2016-01-27 05:14:46"
},
{
"name": "symfony/options-resolver",
@ -2864,16 +2866,16 @@
},
{
"name": "symfony/polyfill-intl-icu",
"version": "v1.0.1",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-icu.git",
"reference": "2deb44160e1c886241c06602b12b98779f728177"
"reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/2deb44160e1c886241c06602b12b98779f728177",
"reference": "2deb44160e1c886241c06602b12b98779f728177",
"url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/66b0bb4abda229bc073eff6bbc8f2685bdaac165",
"reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165",
"shasum": ""
},
"require": {
@ -2883,7 +2885,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "1.1-dev"
}
},
"autoload": {
@ -2915,7 +2917,7 @@
"portable",
"shim"
],
"time": "2015-11-04 20:28:58"
"time": "2016-01-20 09:13:37"
},
{
"name": "symfony/process",
@ -2968,16 +2970,16 @@
},
{
"name": "symfony/property-access",
"version": "v3.0.1",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
"reference": "9bb9f79ade13196fadd0b98504117f117d8221ad"
"reference": "95363dbabd606e404b6c75095669993bf7ddae4b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/9bb9f79ade13196fadd0b98504117f117d8221ad",
"reference": "9bb9f79ade13196fadd0b98504117f117d8221ad",
"url": "https://api.github.com/repos/symfony/property-access/zipball/95363dbabd606e404b6c75095669993bf7ddae4b",
"reference": "95363dbabd606e404b6c75095669993bf7ddae4b",
"shasum": ""
},
"require": {
@ -3024,7 +3026,7 @@
"property path",
"reflection"
],
"time": "2015-12-23 08:00:11"
"time": "2016-01-03 15:35:16"
},
{
"name": "symfony/routing",
@ -3183,16 +3185,16 @@
},
{
"name": "symfony/yaml",
"version": "v3.0.1",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "3df409958a646dad2bc5046c3fb671ee24a1a691"
"reference": "3cf0709d7fe936e97bee9e954382e449003f1d9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691",
"reference": "3df409958a646dad2bc5046c3fb671ee24a1a691",
"url": "https://api.github.com/repos/symfony/yaml/zipball/3cf0709d7fe936e97bee9e954382e449003f1d9a",
"reference": "3cf0709d7fe936e97bee9e954382e449003f1d9a",
"shasum": ""
},
"require": {
@ -3228,7 +3230,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2015-12-26 13:39:53"
"time": "2016-02-02 13:44:19"
},
{
"name": "twig/extensions",

View File

@ -7,8 +7,20 @@ class Hooks {
}
function init() {
$this->setupSubscribe();
$this->setupWPUsers();
$this->setupImageSize();
$this->setupListing();
}
function setupSubscribe() {
$subscribe = Setting::getValue('subscribe', array());
// Subscribe in comments
if((bool)Setting::getValue('subscribe.on_comment.enabled')) {
if(
isset($subscribe['on_comment']['enabled'])
&&
(bool)$subscribe['on_comment']['enabled']
) {
if(is_user_logged_in()) {
add_action(
'comment_form_field_comment',
@ -37,7 +49,11 @@ class Hooks {
}
// Subscribe in registration form
if((bool)Setting::getValue('subscribe.on_register.enabled')) {
if(
isset($subscribe['on_register']['enabled'])
&&
(bool)$subscribe['on_register']['enabled']
) {
if(is_multisite()) {
add_action(
'signup_extra_fields',
@ -62,7 +78,9 @@ class Hooks {
);
}
}
}
function setupWPUsers() {
// WP Users synchronization
add_action(
'user_register',
@ -95,19 +113,35 @@ class Hooks {
'\MailPoet\Segments\WP::synchronizeUser',
1
);
}
function setupImageSize() {
add_filter(
'image_size_names_choose',
array(
$this,
'appendImageSizes'
)
array($this, 'appendImageSize'),
10, 1
);
}
function appendImageSizes($sizes) {
function appendImageSize($sizes) {
return array_merge($sizes, array(
'mailpoet_newsletter_max' => __('MailPoet Newsletter'),
'mailpoet_newsletter_max' => __('MailPoet Newsletter')
));
}
function setupListing() {
add_filter(
'set-screen-option',
array($this, 'setScreenOption'),
10, 3
);
}
function setScreenOption($status, $option, $value) {
if(preg_match('/^mailpoet_(.*)_per_page$/', $option)) {
return $value;
} else {
return $status;
}
}
}

View File

@ -56,6 +56,7 @@ class Initializer {
\ORM::configure('username', Env::$db_username);
\ORM::configure('password', Env::$db_password);
\ORM::configure('logging', WP_DEBUG);
\ORM::configure('driver_options', array(
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET TIME_ZONE = "+00:00"'

View File

@ -13,6 +13,7 @@ use MailPoet\Settings\Pages;
use MailPoet\Subscribers\ImportExport\BootStrapMenu;
use MailPoet\Util\DKIM;
use MailPoet\Util\Permissions;
use MailPoet\Listing;
if(!defined('ABSPATH')) exit;
@ -67,7 +68,7 @@ class Menu {
'forms'
)
);
add_submenu_page(
$subscribers_page = add_submenu_page(
'mailpoet',
__('Subscribers'),
__('Subscribers'),
@ -78,6 +79,17 @@ class Menu {
'subscribers'
)
);
// add limit per page to screen options
add_action('load-'.$subscribers_page, function() {
add_screen_option('per_page', array(
'label' => _x(
'Number of subscribers per page',
'subscribers per page (screen options)'
),
'option' => 'mailpoet_subscribers_per_page'
));
});
add_submenu_page(
'mailpoet',
__('Segments'),
@ -305,6 +317,14 @@ class Menu {
function subscribers() {
$data = array();
// listing: limit per page
$listing_per_page = get_user_meta(
get_current_user_id(), 'mailpoet_subscribers_per_page', true
);
$data['per_page'] = (!empty($listing_per_page))
? (int)$listing_per_page
: Listing\Handler::DEFAULT_LIMIT_PER_PAGE;
$data['segments'] = Segment::findArray();
$data['custom_fields'] = array_map(function($field) {

View File

@ -168,6 +168,7 @@ class FranksRoastHouseTemplate {
"fontColor" => "#ffffff",
"fontFamily" => "Arial",
"fontSize" => "14px",
"fontWeight" => "normal",
"textAlign" => "center"
)
)

View File

@ -325,6 +325,7 @@ class PostNotificationsBlankTemplate {
"fontColor" => "#ffffff",
"fontFamily" => "Arial",
"fontSize" => "18px",
"fontWeight" => "normal",
"textAlign" => "center"
)
)

View File

@ -4,6 +4,8 @@ namespace MailPoet\Listing;
if(!defined('ABSPATH')) exit;
class Handler {
const DEFAULT_LIMIT_PER_PAGE = 20;
private $data = array();
private $model = null;
@ -14,7 +16,10 @@ class Handler {
$this->data = array(
// pagination
'offset' => (isset($data['offset']) ? (int)$data['offset'] : 0),
'limit' => (isset($data['limit']) ? (int)$data['limit'] : 50),
'limit' => (isset($data['limit'])
? (int)$data['limit']
: self::DEFAULT_LIMIT_PER_PAGE
),
// searching
'search' => (isset($data['search']) ? $data['search'] : null),
// sorting

View File

@ -70,19 +70,23 @@ class Model extends \Sudzy\ValidModel {
}
static function bulkTrash($orm) {
$models = $orm->findResultSet();
$models->set_expr('deleted_at', 'NOW()')->save();
return $models->count();
$model = get_called_class();
return self::bulkAction($orm, function($ids) use($model) {
self::rawExecute(join(' ', array(
'UPDATE `'.$model::$_table.'`',
'SET `deleted_at`=NOW()',
'WHERE `id` IN ('.rtrim(str_repeat('?,', count($ids)), ',').')'
)),
$ids
);
});
}
static function bulkDelete($orm) {
$models = $orm->findMany();
$count = 0;
foreach($models as $model) {
$model->delete();
$count++;
}
return $count;
$model = get_called_class();
return self::bulkAction($orm, function($ids) use($model) {
$model::whereIn('id', $ids)->deleteMany();
});
}
function restore() {
@ -90,9 +94,37 @@ class Model extends \Sudzy\ValidModel {
}
static function bulkRestore($orm) {
$models = $orm->findResultSet();
$models->set_expr('deleted_at', 'NULL')->save();
return $models->count();
$model = get_called_class();
return self::bulkAction($orm, function($ids) use($model) {
self::rawExecute(join(' ', array(
'UPDATE `'.$model::$_table.'`',
'SET `deleted_at`=NULL',
'WHERE `id` IN ('.rtrim(str_repeat('?,', count($ids)), ',').')'
)),
$ids
);
});
}
static function bulkAction($orm, $callback = false) {
$total = $orm->count();
if($total > 0) {
$models = $orm->select('id')
->offset(null)
->limit(null)
->findArray();
$ids = array_map(function($model) {
return (int)$model['id'];
}, $models);
if(is_callable($callback)) {
$callback($ids);
}
}
return $total;
}
function duplicate($data = array()) {

View File

@ -33,8 +33,17 @@ class Subscriber extends Model {
}
function addToSegments(array $segment_ids = array()) {
// delete all relations to segments
SubscriberSegment::where('subscriber_id', $this->id)->deleteMany();
$wp_users_segment = Segment::getWPUsers();
if($wp_users_segment !== false) {
// delete all relations to segments except WP users
SubscriberSegment::where('subscriber_id', $this->id)
->whereNotEqual('segment_id', $wp_users_segment->id)
->deleteMany();
} else {
// delete all relations to segments
SubscriberSegment::where('subscriber_id', $this->id)->deleteMany();
}
if(!empty($segment_ids)) {
$segments = Segment::whereIn('id', $segment_ids)->findMany();
@ -252,9 +261,8 @@ class Subscriber extends Model {
}
// segments
$segment_ids = array();
if(isset($data['segments'])) {
$segment_ids = false;
if(array_key_exists('segments', $data)) {
$segment_ids = (array)$data['segments'];
unset($data['segments']);
}
@ -282,7 +290,9 @@ class Subscriber extends Model {
$subscriber->setCustomField($custom_field_id, $value);
}
}
$subscriber->addToSegments($segment_ids);
if($segment_ids !== false) {
$subscriber->addToSegments($segment_ids);
}
}
return $subscriber;
}
@ -411,7 +421,6 @@ class Subscriber extends Model {
}
static function bulkAddToList($orm, $data = array()) {
$segment_id = (isset($data['segment_id']) ? (int)$data['segment_id'] : 0);
$segment = Segment::findOne($segment_id);
@ -435,6 +444,15 @@ class Subscriber extends Model {
return false;
}
static function bulkDelete($orm) {
return parent::bulkAction($orm, function($ids) {
// delete subscribers
Subscriber::whereIn('id', $ids)->deleteMany();
// delete subscribers' relations to segments
SubscriberSegment::whereIn('subscriber_id', $ids)->deleteMany();
});
}
static function subscribed($orm) {
return $orm
->whereNull('deleted_at')

View File

@ -47,9 +47,9 @@ class WP {
}
$subscriber = Subscriber::createOrUpdate($data);
if($subscriber !== false && $subscriber->id()) {
if($subscriber->getErrors() === false && $subscriber->id > 0) {
if($segment !== false) {
$segment->addSubscriber($subscriber->id());
$segment->addSubscriber($subscriber->id);
}
}
break;

View File

@ -17,6 +17,7 @@ class Export {
public $segments;
public $subscribers_without_segment;
public $subscriber_fields;
public $export_path;
public $export_file;
public $export_file_URL;
public $profiler_start;
@ -28,19 +29,23 @@ class Export {
$this->segments = $data['segments'];
$this->subscribers_without_segment = array_search(0, $this->segments);
$this->subscriber_fields = $data['subscriber_fields'];
$this->export_path = Env::$temp_path;
$this->export_file = $this->getExportFile($this->export_format_option);
$this->export_file_URL = $this->getExportFileURL($this->export_file);
$this->profiler_start = microtime(true);
}
function process() {
$subscribers = $this->getSubscribers();
$subscriber_custom_fields = $this->getSubscriberCustomFields();
$formatted_subscriber_fields = $this->formatSubscriberFields(
$this->subscriber_fields,
$subscriber_custom_fields
);
try {
if(is_writable($this->export_path) === false) {
throw new \Exception(__("Couldn't save export file on the server."));
}
$subscribers = $this->getSubscribers();
$subscriber_custom_fields = $this->getSubscriberCustomFields();
$formatted_subscriber_fields = $this->formatSubscriberFields(
$this->subscriber_fields,
$subscriber_custom_fields
);
if($this->export_format_option === 'csv') {
$CSV_file = fopen($this->export_file, 'w');
$format_CSV = function($row) {
@ -178,7 +183,7 @@ class Export {
function getExportFile($format) {
return sprintf(
Env::$temp_path . '/MailPoet_export_%s.%s',
$this->export_path . '/MailPoet_export_%s.%s',
substr(md5(time()), 0, 4),
$format
);

View File

@ -46,7 +46,7 @@ class Engine
*/
public function addValidator($label, $function)
{
if (isset($this->_checks[$label])) throw Exception();
if (isset($this->_checks[$label])) throw \Exception();
$this->setValidator($label, $function);
}

View File

@ -6,7 +6,7 @@ namespace MailPoet\Util;
* @license MIT License
* */
if (!class_exists('ZipArchive')) { throw new Exception('ZipArchive not found'); }
if (!class_exists('ZipArchive')) { throw new \Exception('ZipArchive not found'); }
class XLSXWriter
{

View File

@ -4,7 +4,7 @@ if(!defined('ABSPATH')) exit;
use \MailPoet\Config\Initializer;
/*
* Plugin Name: MailPoet
* Version: 0.0.15
* Version: 0.0.17
* Plugin URI: http://www.mailpoet.com
* Description: MailPoet Newsletters.
* Author: MailPoet
@ -22,7 +22,7 @@ use \MailPoet\Config\Initializer;
require 'vendor/autoload.php';
define('MAILPOET_VERSION', '0.0.15');
define('MAILPOET_VERSION', '0.0.17');
$initializer = new Initializer(array(
'file' => __FILE__,

View File

@ -63,6 +63,10 @@ define([
expect(model.get('styles.block.fontSize')).to.match(/^\d+px$/);
});
it("has a text font weight", function () {
expect(model.get('styles.block.fontWeight')).to.match(/^(bold|normal)$/);
});
it("has width", function () {
expect(model.get('styles.block.width')).to.match(/^\d+px$/);
});
@ -78,7 +82,7 @@ define([
});
it("triggers autosave if any attribute changes", function () {
var mock = sinon.mock().exactly(11).withArgs('autoSave');
var mock = sinon.mock().exactly(12).withArgs('autoSave');
EditorApplication.getChannel = sinon.stub().returns({
trigger: mock,
});
@ -93,6 +97,7 @@ define([
model.set('styles.block.fontColor', '#345678');
model.set('styles.block.fontFamily', 'Some other style');
model.set('styles.block.fontSize', '10px');
model.set('styles.block.fontWeight', 'bold');
mock.verify();
});
@ -114,6 +119,7 @@ define([
fontColor: '#345678',
fontFamily: 'Tahoma',
fontSize: '30px',
fontWeight: 'bold',
},
},
},
@ -133,6 +139,7 @@ define([
expect(model.get('styles.block.fontColor')).to.equal('#345678');
expect(model.get('styles.block.fontFamily')).to.equal('Tahoma');
expect(model.get('styles.block.fontSize')).to.equal('30px');
expect(model.get('styles.block.fontWeight')).to.equal('bold');
});
});
@ -179,6 +186,7 @@ define([
fontColor: '#345678',
fontFamily: 'Arial',
fontSize: '12px',
fontWeight: 'bold',
},
},
});
@ -235,6 +243,10 @@ define([
it('has a specified font size', function () {
expect(view.$('.mailpoet_editor_button').css('font-size')).to.equal(model.get('styles.block.fontSize'));
});
it('has a specified font weight', function () {
expect(view.$('.mailpoet_editor_button').css('font-weight')).to.equal(model.get('styles.block.fontWeight'));
});
});
});
@ -318,6 +330,12 @@ define([
expect(model.get('styles.block.fontSize')).to.equal(newValue);
});
it('updates the model when font weight changes', function () {
var newValue = 'bold';
view.$('.mailpoet_field_button_font_weight').prop('checked', true).change();
expect(model.get('styles.block.fontWeight')).to.equal(newValue);
});
it('updates the model when background color changes', function () {
var newValue = '#cccccc';

View File

@ -1,8 +1,9 @@
define([
'newsletter_editor/App',
'newsletter_editor/components/communication',
'newsletter_editor/blocks/posts'
], function(EditorApplication, CommunicationComponent, PostsBlock) {
'newsletter_editor/blocks/posts',
'newsletter_editor/blocks/container'
], function(EditorApplication, CommunicationComponent, PostsBlock, ContainerBlock) {
describe('Posts', function () {
Backbone.Radio = {
@ -255,7 +256,7 @@ define([
global.stubConfig(EditorApplication, {
blockDefaults: {},
});
EditorApplication.getBlockTypeModel = sinon.stub().returns(Backbone.Model);
EditorApplication.getBlockTypeModel = sinon.stub().returns(ContainerBlock.ContainerBlockModel);
model = new (PostsBlock.PostsBlockModel)();
view = new (PostsBlock.PostsBlockSettingsView)({model: model});
});

View File

@ -147,7 +147,11 @@ define([
},
},
'newsletter_editor/App': EditorApplication,
'html2canvas': function() { return html2canvasMock; },
'html2canvas': function() {
return {
then: function() { return html2canvasMock; }
};
},
});
var view = new (module.SaveView)();
view.render();

View File

@ -23,18 +23,17 @@ class ListingCest {
}
function itShouldGroup(UnitTester $I) {
$I->generateSubscribers(10);
$I->generateSubscribers(20, array('status' => 'unsubscribed'));
$I->generateSubscribers(30, array('status' => 'subscribed'));
$I->generateSubscribers(1);
$I->generateSubscribers(2, array('status' => 'unsubscribed'));
$I->generateSubscribers(3, array('status' => 'subscribed'));
$listing = new Listing\Handler(
'\MailPoet\Models\Subscriber',
array('group' => 'subscribed')
);
$result = $listing->get();
expect($result['groups'])->notEmpty();
expect($result['count'])->equals(30);
expect($result['count'])->equals(3);
}
function itShouldSearch(UnitTester $I) {
@ -53,10 +52,6 @@ class ListingCest {
expect($result['count'])->equals(1);
}
function itShouldPaginate(UnitTester $I) {
}
function _after() {
Subscriber::deleteMany();
}

View File

@ -6,10 +6,14 @@ use MailPoet\Models\SubscriberCustomField;
class CustomFieldCest {
function _before() {
$this->custom_field = CustomField::createOrUpdate(array(
'name' => 'Birthdate',
'type' => 'date'
));
$this->data = array(
'name' => 'City',
'type' => 'text',
'params' => array(
'label' => 'What is your city?'
)
);
$this->custom_field = CustomField::createOrUpdate($this->data);
$this->subscribers = array(
array(
@ -31,21 +35,21 @@ class CustomFieldCest {
}
function itHasAName() {
expect($this->custom_field->name)->equals('Birthdate');
expect($this->custom_field->name)->equals($this->data['name']);
}
function itHasAType() {
expect($this->custom_field->type)->equals('date');
expect($this->custom_field->type)->equals($this->data['type']);
}
function itHasSerializedParams() {
$params = unserialize($this->custom_field->params);
expect($params)->equals($this->data['params']);
}
function itCanDecodeParams() {
$custom_field = $this->custom_field->asArray();
expect($custom_field['params'])->hasKey('label');
}
function itHasDefaultParams() {
$params = unserialize($this->custom_field->params);
expect($params['label'])->equals('Birthdate');
expect($custom_field['params'])->equals($this->data['params']);
}
function itHasToBeValid() {
@ -59,18 +63,33 @@ class CustomFieldCest {
expect($errors[1])->equals('You need to specify a type.');
}
function itCanBeUpdated() {
$custom_field = $this->custom_field->asArray();
$custom_field['name'] = 'Favorite color';
$custom_field['type'] = 'text';
function itHasACreatedAtOnCreation() {
$custom_field = CustomField::findOne($this->custom_field->id);
expect($custom_field->created_at)->notNull();
expect($custom_field->created_at)->notEquals('0000-00-00 00:00:00');
}
$custom_field = CustomField::createOrUpdate($custom_field);
function itHasAnUpdatedAtOnCreation() {
$custom_field = CustomField::findOne($this->custom_field->id);
expect($custom_field->updated_at)
->equals($custom_field->created_at);
}
expect($custom_field->getErrors())->false();
function itUpdatesTheUpdatedAtOnUpdate() {
$custom_field = CustomField::findOne($this->custom_field->id);
$created_at = $custom_field->created_at;
sleep(1);
$custom_field->name = 'Country';
$custom_field->save();
$updated_custom_field = CustomField::findOne($custom_field->id);
expect($updated_custom_field->name)->equals('Favorite color');
expect($updated_custom_field->type)->equals('text');
expect($updated_custom_field->created_at)->equals($created_at);
$is_time_updated = (
$updated_custom_field->updated_at > $updated_custom_field->created_at
);
expect($is_time_updated)->true();
}
function itCanHaveManySubscribers() {
@ -95,7 +114,6 @@ class CustomFieldCest {
$association->custom_field_id = $this->custom_field->id;
$association->value = '12/12/2012';
$association->save();
$custom_field = CustomField::findOne($this->custom_field->id);
$subscriber = $custom_field->subscribers()->findOne();
expect($subscriber->value)->equals($association->value);

View File

@ -46,6 +46,35 @@ class FormCest {
expect($form->name)->equals('My Form');
}
function itHasACreatedAtOnCreation() {
$form = Form::findOne($this->form->id);
expect($form->created_at)->notNull();
expect($form->created_at)->notEquals('0000-00-00 00:00:00');
}
function itHasAnUpdatedAtOnCreation() {
$form = Form::findOne($this->form->id);
expect($form->updated_at)
->equals($form->created_at);
}
function itUpdatesTheUpdatedAtOnUpdate() {
$form = Form::findOne($this->form->id);
$created_at = $form->created_at;
sleep(1);
$form->name = 'new name';
$form->save();
$updated_form = Form::findOne($form->id);
expect($updated_form->created_at)->equals($created_at);
$is_time_updated = (
$updated_form->updated_at > $updated_form->created_at
);
expect($is_time_updated)->true();
}
function itCanCreateOrUpdate() {
$created_form = Form::createOrUpdate(array(
'name' => 'Created Form'

View File

@ -37,7 +37,7 @@ class NewsletterCest {
expect($this->newsletter->getErrors())->false();
}
function itHasSubject() {
function itHasASubject() {
$newsletter = Newsletter::findOne($this->newsletter->id);
expect($newsletter->subject)->equals($this->newsletter->subject);
}
@ -57,6 +57,35 @@ class NewsletterCest {
expect($newsletter->preheader)->equals($this->newsletter->preheader);
}
function itHasACreatedAtOnCreation() {
$newsletter = Newsletter::findOne($this->newsletter->id);
expect($newsletter->created_at)->notNull();
expect($newsletter->created_at)->notEquals('0000-00-00 00:00:00');
}
function itHasAnUpdatedAtOnCreation() {
$newsletter = Newsletter::findOne($this->newsletter->id);
expect($newsletter->updated_at)
->equals($newsletter->created_at);
}
function itUpdatesTheUpdatedAtOnUpdate() {
$newsletter = Newsletter::findOne($this->newsletter->id);
$created_at = $newsletter->created_at;
sleep(1);
$newsletter->subject = 'New Subject';
$newsletter->save();
$updated_newsletter = Newsletter::findOne($newsletter->id);
expect($updated_newsletter->created_at)->equals($created_at);
$is_time_updated = (
$updated_newsletter->updated_at > $updated_newsletter->created_at
);
expect($is_time_updated)->true();
}
function itCanBeQueued() {
$queue = $this->newsletter->getQueue();
expect($queue)->false();

View File

@ -6,14 +6,14 @@ use MailPoet\Models\NewsletterOptionField;
class NewsletterOptionFieldCest {
function _before() {
$this->before_time = time();
$this->data = array(
'name' => 'Event',
'newsletter_type' => 'welcome'
);
$this->option_field = NewsletterOptionField::create();
$this->option_field->hydrate($this->data);
$this->saved = $this->option_field->save();
$option = NewsletterOptionField::create();
$option->hydrate($this->data);
$this->option_field = $option->save();
$this->newsletter_data = array(
array(
'subject' => 'Test newsletter 1',
@ -31,20 +31,17 @@ class NewsletterOptionFieldCest {
}
function itCanBeCreated() {
expect($this->saved->id() > 0)->true();
expect($this->saved->getErrors())->false();
expect($this->option_field->id() > 0)->true();
expect($this->option_field->getErrors())->false();
}
function itHasName() {
$option_field = NewsletterOptionField::where('name', $this->data['name'])
->findOne();
expect($option_field->name)->equals($this->data['name']);
expect($this->option_field->name)->equals($this->data['name']);
}
function itHasNewsletterType() {
$option_field = NewsletterOptionField::where('name', $this->data['name'])
->findOne();
expect($option_field->newsletter_type)->equals($this->data['newsletter_type']);
expect($this->option_field->newsletter_type)
->equals($this->data['newsletter_type']);
}
function itHasToBeValid() {
@ -58,36 +55,31 @@ class NewsletterOptionFieldCest {
}
function itHasACreatedAtOnCreation() {
$option_field = NewsletterOptionField::where('name', $this->data['name'])
->findOne();
$time_difference = strtotime($option_field->created_at) >= $this->before_time;
expect($time_difference)->equals(true);
$option_field = NewsletterOptionField::findOne($this->option_field->id);
expect($option_field->created_at)->notNull();
expect($option_field->created_at)->notEquals('0000-00-00 00:00:00');
}
function itHasAnUpdatedAtOnCreation() {
$option_field = NewsletterOptionField::where('name', $this->data['name'])
->findOne();
$time_difference = strtotime($option_field->updated_at) >= $this->before_time;
expect($time_difference)->equals(true);
}
function itKeepsTheCreatedAtOnUpdate() {
$option_field = NewsletterOptionField::where('name', $this->data['name'])
->findOne();
$old_created_at = $option_field->created_at;
$option_field->name = 'new name';
$option_field->save();
expect($old_created_at)->equals($option_field->created_at);
$option_field = NewsletterOptionField::findOne($this->option_field->id);
expect($option_field->updated_at)
->equals($option_field->created_at);
}
function itUpdatesTheUpdatedAtOnUpdate() {
$option_field = NewsletterOptionField::where('name', $this->data['name'])
->findOne();
$update_time = time();
$option_field = NewsletterOptionField::findOne($this->option_field->id);
$created_at = $option_field->created_at;
sleep(1);
$option_field->name = 'new name';
$option_field->save();
$time_difference = strtotime($option_field->updated_at) >= $update_time;
expect($time_difference)->equals(true);
$updated_option_field = NewsletterOptionField::findOne($option_field->id);
$is_time_updated = (
$updated_option_field->updated_at > $updated_option_field->created_at
);
expect($is_time_updated)->true();
}
function itCanHaveManyNewsletters() {

View File

@ -4,7 +4,6 @@ use MailPoet\Models\NewsletterTemplate;
class NewsletterTemplateCest {
function _before() {
$this->before_time = time();
$this->data = array(
'name' => 'Some template',
'description' => 'My nice template',

View File

@ -8,11 +8,12 @@ use MailPoet\Models\SubscriberSegment;
class SegmentCest {
function _before() {
$this->before_time = time();
$this->data = array(
'name' => 'some name',
'description' => 'some description'
);
$this->segment = Segment::createOrUpdate($this->data);
$this->subscribers_data = array(
array(
'first_name' => 'John',
@ -37,7 +38,6 @@ class SegmentCest {
'type' => 'standard'
)
);
$this->segment = Segment::createOrUpdate($this->data);
}
function itCanBeCreated() {
@ -76,36 +76,32 @@ class SegmentCest {
}
function itHasACreatedAtOnCreation() {
$segment = Segment::where('name', $this->data['name'])
->findOne();
$time_difference = strtotime($segment->created_at) >= $this->before_time;
expect($time_difference)->equals(true);
$segment = Segment::findOne($this->segment->id);
expect($segment->created_at)->notNull();
expect($segment->created_at)->notEquals('0000-00-00 00:00:00');
}
function itHasAnUpdatedAtOnCreation() {
$segment = Segment::where('name', $this->data['name'])
->findOne();
$time_difference = strtotime($segment->updated_at) >= $this->before_time;
expect($time_difference)->equals(true);
}
function itKeepsTheCreatedAtOnUpdate() {
$segment = Segment::where('name', $this->data['name'])
->findOne();
$old_created_at = $segment->created_at;
$segment->name = 'new name';
$segment->save();
expect($old_created_at)->equals($segment->created_at);
$segment = Segment::findOne($this->segment->id);
expect($segment->updated_at)
->equals($segment->created_at);
}
function itUpdatesTheUpdatedAtOnUpdate() {
$segment = Segment::where('name', $this->data['name'])
->findOne();
$update_time = time();
$segment = Segment::findOne($this->segment->id);
$created_at = $segment->created_at;
sleep(1);
$segment->name = 'new name';
$segment->save();
$time_difference = strtotime($segment->updated_at) >= $update_time;
expect($time_difference)->equals(true);
$updated_segment = Segment::findOne($segment->id);
expect($updated_segment->created_at)->equals($created_at);
$is_time_updated = (
$updated_segment->updated_at > $updated_segment->created_at
);
expect($is_time_updated)->true();
}
function itCanCreateOrUpdate() {

View File

@ -2,6 +2,15 @@
use MailPoet\Models\Setting;
class SettingCest {
function itCanBeCreated() {
$setting = Setting::createOrUpdate(array(
'name' => 'key',
'value' => 'val'
));
expect($setting->id() > 0)->true();
expect($setting->getErrors())->false();
}
function itHasToBeValid() {
$invalid_setting = Setting::createOrUpdate();
$errors = $invalid_setting->getErrors();

View File

@ -211,6 +211,13 @@ class ExportCest {
expect(count($subscribers))->equals(2);
}
function itRequiresWritableExportFile() {
$this->export->export_path = '/fake_folder';
$result = $this->export->process();
expect($result['errors'][0])
->equals("Couldn't save export file on the server.");
}
function itCanProcess() {
$this->export->export_file = $this->export->getExportFile('csv');
$this->export->export_format_option = 'csv';

View File

@ -6,9 +6,13 @@
</div>
<script type="text/javascript">
jQuery(function($) {
var field_values = {{#if params.values}}{{{ json_encode params.values }}}{{else}}[]{{/if}},
field_type = "{{ type }}",
template = Handlebars.compile($('#field_settings_values_item').html());
{{#if params.values}}
var field_values = {{{ json_encode params.values }}};
{{else}}
var field_values = [{ value: '' }];
{{/if}}
var field_type = "{{ type }}";
var template = Handlebars.compile($('#field_settings_values_item').html());
// set default value for checkbox type if there is no value defined
if(field_type === 'checkbox' && field_values.length !== 1) {
@ -51,6 +55,13 @@ jQuery(function($) {
$(item).find('.is_checked').attr('name', 'params[values]['+index+'][is_checked]');
$(item).find('.value').attr('name', 'params[values]['+index+'][value]');
});
// hide remove button if only one item remains
if ($('.mailpoet_multiple_values li').length > 1) {
$('.mailpoet_multiple_values .remove').show();
} else {
$('.mailpoet_multiple_values .remove').hide();
}
}
{{#ifCond type '!=' 'checkbox'}}
$('.mailpoet_multiple_values').on('click', '.is_checked', function() {

View File

@ -7,7 +7,14 @@
{{#if is_checked}}checked="checked"{{/if}} value="1"/>
{{/ifCond}}
<input type="text" name="" class="value" value="{{ value }}" />
<input
type="text"
name=""
class="value"
value="{{ value }}"
data-parsley-errors-messages-disabled="true"
data-parsley-required="true"
/>
{{#ifCond type 'in' 'radio,select'}}
<a class="remove" href="javascript:;"><%= __('Remove') %></a>

View File

@ -8,12 +8,15 @@
'searchLabel': __('Search'),
'loadingItems': __('Loading forms...'),
'noItemsFound': __('No forms found.'),
'selectAllLabel': __('All forms on this page are selected.'),
'selectedAllLabel': __('All %d forms are selected.'),
'selectAllLink': __('Select all forms on all pages.'),
'clearSelection': __('Clear selection.'),
'permanentlyDeleted': __('%d forms permanently deleted.')
}) %>
<script type="text/javascript">
var mailpoet_segments = <%= json_encode(segments) %>;
var mailpoet_form_edit_url =
"<%= admin_url('admin.php?page=mailpoet-form-editor&id=') %>";
</script>

View File

@ -947,6 +947,7 @@
fontColor: '#00ddff',
fontFamily: 'Arial',
fontSize: '20px',
fontWeight: 'normal',
textAlign: 'center',
}
}
@ -982,6 +983,7 @@
fontColor: '#ffffff',
fontFamily: 'Verdana',
fontSize: '18px',
fontWeight: 'normal',
textAlign: 'center',
},
},
@ -1069,6 +1071,7 @@
fontColor: '#000000',
fontFamily: 'Arial',
fontSize: '20px',
fontWeight: 'normal',
textAlign: 'center',
},
},

View File

@ -3,8 +3,8 @@
<div class="mailpoet_form_field">
<div class="mailpoet_form_field_title mailpoet_form_field_title_inline"><%= __('Show:') %></div>
<div class="mailpoet_form_field_input_option">
<input type="text" class="mailpoet_input mailpoet_input_small mailpoet_automated_latest_content_show_amount" value="{{ model.amount }}" />
<select class="mailpoet_select mailpoet_select_small mailpoet_automated_latest_content_content_type">
<input type="text" class="mailpoet_input mailpoet_input_small mailpoet_automated_latest_content_show_amount" value="{{ model.amount }}" maxlength="2" size="2" />
<select class="mailpoet_select mailpoet_select_large mailpoet_automated_latest_content_content_type">
<option value="post" {{#ifCond model.contentType '==' 'post'}}SELECTED{{/ifCond}}><%= __('Posts') %></option>
<option value="page" {{#ifCond model.contentType '==' 'page'}}SELECTED{{/ifCond}}><%= __('Pages') %></option>
<option value="mailpoet_page" {{#ifCond model.contentType '==' 'mailpoet_page'}}SELECTED{{/ifCond}}><%= __('MailPoet pages') %></option>
@ -291,6 +291,6 @@
</div>
<div class="mailpoet_form_field">
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_done_editing" value="<%= __('Done') %>" />
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') %>" />
</div>

View File

@ -1,5 +1,5 @@
<div class="mailpoet_tools"></div>
<div class="mailpoet_content">
<a href="{{ model.url }}" class="mailpoet_editor_button" style="{{#ifCond model.styles.block.textAlign '==' 'left'}}margin: 0 auto 0 0; {{/ifCond}}{{#ifCond model.styles.block.textAlign '==' 'center'}}margin: auto; {{/ifCond}}{{#ifCond model.styles.block.textAlign '==' 'right'}}margin: 0 0 0 auto; {{/ifCond}}line-height: {{ model.styles.block.lineHeight }}; width: {{ model.styles.block.width }}; background-color: {{ model.styles.block.backgroundColor }}; color: {{ model.styles.block.fontColor }}; font-family: {{ model.styles.block.fontFamily }}; font-size: {{ model.styles.block.fontSize }}; border: {{ model.styles.block.borderWidth }} {{ model.styles.block.borderStyle }} {{ model.styles.block.borderColor }}; border-radius: {{ model.styles.block.borderRadius }};" onClick="return false;">{{ model.text }}</a>
<a href="{{ model.url }}" class="mailpoet_editor_button" style="{{#ifCond model.styles.block.textAlign '==' 'left'}}margin: 0 auto 0 0; {{/ifCond}}{{#ifCond model.styles.block.textAlign '==' 'center'}}margin: auto; {{/ifCond}}{{#ifCond model.styles.block.textAlign '==' 'right'}}margin: 0 0 0 auto; {{/ifCond}}line-height: {{ model.styles.block.lineHeight }}; width: {{ model.styles.block.width }}; background-color: {{ model.styles.block.backgroundColor }}; color: {{ model.styles.block.fontColor }}; font-family: {{ model.styles.block.fontFamily }}; font-size: {{ model.styles.block.fontSize }}; font-weight: {{ model.styles.block.fontWeight }}; border: {{ model.styles.block.borderWidth }} {{ model.styles.block.borderStyle }} {{ model.styles.block.borderColor }}; border-radius: {{ model.styles.block.borderRadius }};" onClick="return false;">{{ model.text }}</a>
</div>
<div class="mailpoet_block_highlight"></div>

View File

@ -56,6 +56,14 @@
</div>
<div class="mailpoet_form_field_title mailpoet_form_field_title_inline"><%= __('Text') %></div>
</div>
<div class="mailpoet_form_field">
<div class="mailpoet_form_field_checkbox_option">
<label>
<input type="checkbox" name="fontWeight" class="mailpoet_field_button_font_weight" value="bold" {{#ifCond styles.block.fontWeight '===' 'bold'}}CHECKED{{/ifCond}}/>
<%= __('Bold') %>
</label>
</div>
</div>
<div class="mailpoet_form_field">
<div class="mailpoet_form_field_input_option">
<input type="text" name="background-color" class="mailpoet_field_button_background_color mailpoet_color" value="{{ model.styles.block.backgroundColor }}" />
@ -101,11 +109,11 @@
</div>
{{#ifCond renderOptions.hideApplyToAll '!==' true}}
<div class="mailpoet_form_field">
<input type="button" name="replace-all-button-styles" class="mailpoet_button mailpoet_button_full mailpoet_button_secondary mailpoet_field_button_replace_all_styles" value="<%= __('Apply styles to all buttons') %>" />
<input type="button" name="replace-all-button-styles" class="button button-secondary mailpoet_button_full mailpoet_field_button_replace_all_styles" value="<%= __('Apply styles to all buttons') %>" />
</div>
{{/ifCond}}
<div class="mailpoet_form_field">
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_done_editing" value="<%= __('Done') %>" />
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') %>" />
</div>

View File

@ -11,5 +11,5 @@
<div class="mailpoet_container_columns_settings"></div>
<div class="mailpoet_form_field">
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_done_editing" value="<%= __('Done') %>" />
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') %>" />
</div>

View File

@ -29,10 +29,10 @@
</div>
{{#ifCond renderOptions.hideApplyToAll '!==' true}}
<div class="mailpoet_form_field">
<input type="button" name="apply-to-all-dividers" class="mailpoet_button mailpoet_button_full mailpoet_button_secondary mailpoet_button_divider_apply_to_all" value="<%= __('Apply to all dividers') %>" />
<input type="button" name="apply-to-all-dividers" class="button button-secondary mailpoet_button_full mailpoet_button_divider_apply_to_all" value="<%= __('Apply to all dividers') %>" />
</div>
{{/ifCond}}
<div class="mailpoet_form_field">
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_done_editing" value="<%= __('Done') %>" />
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') %>" />
</div>

View File

@ -56,5 +56,5 @@
</div>
<div class="mailpoet_form_field">
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_done_editing" value="<%= __('Done') %>" />
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') %>" />
</div>

View File

@ -56,5 +56,5 @@
</div>
<div class="mailpoet_form_field">
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_done_editing" value="<%= __('Done') %>" />
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') %>" />
</div>

View File

@ -33,9 +33,9 @@
</div>
<hr />
<div class="mailpoet_form_field">
<input type="button" name="select-another-image" class="mailpoet_button mailpoet_button_full mailpoet_button_secondary mailpoet_field_image_select_another_image" value="<%= __('Select another image') %>" />
<input type="button" name="select-another-image" class="button button-secondary mailpoet_button_full mailpoet_field_image_select_another_image" value="<%= __('Select another image') %>" />
</div>
<div class="mailpoet_form_field">
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_done_editing" value="<%= __('Done') %>" />
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') %>" />
</div>

View File

@ -6,5 +6,5 @@
<a href="javascript:;" class="mailpoet_settings_posts_show_post_selection mailpoet_hidden"><%= __('Back to selection') %></a>
<a href="javascript:;" class="mailpoet_settings_posts_show_display_options"><%= __('Display options') %></a>
</div>
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_settings_posts_insert_selected" value="<%= __('Insert selected') %>" />
<input type="button" class="button button-primary mailpoet_settings_posts_insert_selected" value="<%= __('Insert selected') %>" />
</div>

View File

@ -3,5 +3,5 @@
<h3><%= __('Styles') %></h3>
<div id="mailpoet_social_icons_styles"></div>
<div class="mailpoet_form_field">
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_done_editing" value="<%= __('Done') %>" />
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') %>" />
</div>

View File

@ -1,2 +1,2 @@
<div id="mailpoet_social_icon_selector_contents"></div>
<input type="button" class="mailpoet_button mailpoet_button_full mailpoet_button_secondary mailpoet_add_social_icon" value="<%= __('Add another social network') %>" />
<input type="button" class="button button-secondary mailpoet_button_full mailpoet_add_social_icon" value="<%= __('Add another social network') %>" />

View File

@ -7,5 +7,5 @@
</div>
<div class="mailpoet_form_field">
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_done_editing" value="<%= __('Done') %>" />
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') %>" />
</div>

View File

@ -1,8 +1,8 @@
<div class="mailpoet_save_wrapper">
<div class="mailpoet_button_group">
<input type="button" name="save" value="<%= __('Save') %>" class="mailpoet_button mailpoet_button_primary mailpoet_save_button" /><button class="mailpoet_button mailpoet_button_primary mailpoet_save_show_options" ><span class="dashicons mailpoet_save_show_options_icon"></span></button>
<input type="button" name="save" value="<%= __('Save') %>" class="button button-primary mailpoet_save_button" /><button class="button button-primary mailpoet_save_show_options" ><span class="dashicons mailpoet_save_show_options_icon"></span></button>
</div>
<input type="button" name="next" value="<%= __('Next') %>" class="mailpoet_button mailpoet_button_primary mailpoet_save_next" />
<input type="button" name="next" value="<%= __('Next') %>" class="button button-primary mailpoet_save_next" />
<span class="mailpoet_save_error"></span>
<div class="mailpoet_editor_last_saved mailpoet_hidden"><%= __('Autosaved') %> <span class="mailpoet_autosaved_at"></span></div>
<br />
@ -15,12 +15,12 @@
<p><b class="mailpoet_save_as_template_title"><%= __('Save as template') %></b></p>
<p><input type="text" name="template_name" value="" placeholder="<%= __('Insert template name') %>" class="mailpoet_input mailpoet_save_as_template_name" /></p>
<p><input type="text" name="template_description" value="" placeholder="<%= __('Insert template description') %>" class="mailpoet_input mailpoet_save_as_template_description" /></p>
<p><input type="button" name="save_as_template" value="<%= __('Save as template') %>" class="mailpoet_button mailpoet_button_full mailpoet_button_primary mailpoet_save_as_template" /></p>
<p><input type="button" name="save_as_template" value="<%= __('Save as template') %>" class="button button-primary mailpoet_button_full mailpoet_save_as_template" /></p>
</div>
<div class="mailpoet_export_template_container mailpoet_hidden">
<p><b class="mailpoet_export_template_title"><%= __('Export template') %></b></p>
<p><input type="text" name="export_template_name" value="" placeholder="<%= __('Template name') %>" class="mailpoet_input mailpoet_export_template_name" /></p>
<p><input type="text" name="export_template_description" value="" placeholder="<%= __('Template description') %>" class="mailpoet_input mailpoet_export_template_description" /></p>
<p><input type="button" name="export_template" value="<%= __('Export template') %>" class="mailpoet_button mailpoet_button_full mailpoet_button_primary mailpoet_export_template" /></p>
<p><input type="button" name="export_template" value="<%= __('Export template') %>" class="button button-primary mailpoet_button_full mailpoet_export_template" /></p>
</div>
</div>

View File

@ -9,10 +9,10 @@
</div>
<div class="mailpoet_form_field">
<input type="button" id="mailpoet_send_preview" class="mailpoet_button mailpoet_button_full mailpoet_button_primary" value="<%= __('Send preview') %>" />
<input type="button" id="mailpoet_send_preview" class="button button-primary mailpoet_button_full" value="<%= __('Send preview') %>" />
</div>
<hr class="mailpoet_separator" />
<input type="button" name="preview" class="mailpoet_button mailpoet_button_full mailpoet_button_primary mailpoet_show_preview" value="<%= __('View in browser') %>" />
<input type="button" name="preview" class="button button-primary mailpoet_button_full mailpoet_show_preview" value="<%= __('View in browser') %>" />
</div>

View File

@ -10,7 +10,7 @@
'noItemsFound': __('No newsletters found.'),
'selectAllLabel': __('All newsletters on this page are selected.'),
'selectedAllLabel': __('All %d newsletters are selected.'),
'selectAllLink': __('Select all pages.'),
'selectAllLink': __('Select all newsletters on all pages.'),
'clearSelection': __('Clear selection.'),
'permanentlyDeleted': __('%d newsletters permanently deleted.')
}) %>

View File

@ -187,20 +187,25 @@
jQuery(function($) {
$(function() {
$('#mailpoet_reinstall').on('click', function() {
MailPoet.Ajax.post({
'endpoint': 'setup',
'action': 'reset'
}).done(function(response) {
if(response.result === true) {
MailPoet.Notice.success(
"<%= __('MailPoet has been reinstalled successfully using the same version. Settings and data have been deleted.') %>",
{ scroll: true });
} else {
MailPoet.Notice.error(
"<%= __('MailPoet could not be reinstalled. You might need to remove it manually first.') %>",
{ scroll: true });
}
});
if(confirm(
"<%= __('If you confirm this, all your current MailPoet data will be erased (newsletters, statistics, subscribers, etc...)') %>"
)) {
MailPoet.Ajax.post({
'endpoint': 'setup',
'action': 'reset'
}).done(function(response) {
if(response.result === true) {
MailPoet.Notice.success(
"<%= __('MailPoet has been reinstalled successfully using the same version. Settings and data have been deleted.') %>",
{ scroll: true });
} else {
MailPoet.Notice.error(
"<%= __('MailPoet could not be reinstalled. You might need to remove it manually first.') %>",
{ scroll: true });
}
});
}
return false;
});
});
});

View File

@ -140,10 +140,10 @@
<input id="new_segment_name" type="text" name="name"/>
</p>
<p class="mailpoet_validation_error" data-error="segment_name_required">
<%= __('You need to specify a name') %>
<%= __('You need to specify a name.') %>
</p>
<p class="mailpoet_validation_error" data-error="segment_name_not_unique">
<%= __('This name is already taken') %>
<%= __('Another record already exists. Please specify a different "%1$s".')|format('name') %>
</p>
<p>
<label><%= __('Description') %>:</label>
@ -198,10 +198,10 @@
<input id="new_column_name" type="text" name="name" value="{{ name }}"/>
</p>
<p class="mailpoet_validation_error" data-error="name_required">
<%= __('You need to specify a name') %>
<%= __('You need to specify a name.') %>
</p>
<p class="mailpoet_validation_error" data-error="name_not_unique">
<%= __('This name is already taken') %>
<%= __('This name is already taken.') %>
</p>
<hr/>

View File

@ -10,12 +10,13 @@
'noItemsFound': __('No subscribers found.'),
'selectAllLabel': __('All subscribers on this page are selected.'),
'selectedAllLabel': __('All %d subscribers are selected.'),
'selectAllLink': __('Select all pages.'),
'selectAllLink': __('Select all subscribers on all pages.'),
'clearSelection': __('Clear selection.'),
'permanentlyDeleted': __('%d subscribers permanently deleted.')
}) %>
<script type="text/javascript">
var mailpoet_listing_per_page = <%= per_page %>;
var mailpoet_segments = <%= json_encode(segments) %>;
var mailpoet_custom_fields = <%= json_encode(custom_fields) %>;
var mailpoet_month_names = <%= json_encode(month_names) %>;