fixed conflicts

This commit is contained in:
Jonathan Labreuille
2015-12-04 11:25:06 +01:00
34 changed files with 1047 additions and 666 deletions

View File

@ -38,9 +38,12 @@
right: 0
bottom: 0
background-color: rgba(255, 255, 255, 0.0)
opacity: 0
transition: all 200ms cubic-bezier(0.420, 0.000, 0.580, 1.000) /* ease-in-out */
&:hover
background-color: rgba(255, 255, 255, 0.7)
opacity: 1
&::after
content: " "

View File

@ -76,13 +76,24 @@ $layer-selector-width = 30px
display: inline-block
padding: 2px
vertical-align: top
animation-background-color()
.mailpoet_tool
padding: 0
.mailpoet_delete_block_activate
max-width: 100%
display: inline-block
opacity: 1
animation-fade-in-and-scale-horizontally()
.mailpoet_delete_block_confirm,
.mailpoet_delete_block_cancel
display: none
max-width: 0
opacity: 0
overflow: hidden
display: inline-block
animation-fade-in-and-scale-horizontally()
.mailpoet_delete_block_activated
width: auto
@ -93,11 +104,14 @@ $layer-selector-width = 30px
height: auto
.mailpoet_delete_block_activate
display: none
overflow: hidden
max-width: 0
opacity: 0
.mailpoet_delete_block_confirm,
.mailpoet_delete_block_cancel
display: inline-block
max-width: 100%
opacity: 1
.mailpoet_delete_block_confirm
color: $warning-text-color

View File

@ -52,6 +52,7 @@ $draggable-widget-z-index = 2
padding: 0
margin: 0
z-index: $draggable-widget-z-index
animation-fade-in-and-scale-up()
.mailpoet_widget_icon
padding: 0

View File

@ -32,7 +32,7 @@ $widget-icon-width = 30px
.mailpoet_region_content
max-height: 2000px
transition: max-height 0.2s ease
transition: max-height 300ms ease
padding: 0 20px
margin-top: 12px

View File

@ -18,3 +18,6 @@
& > .mailpoet_block
width: 100%
.mailpoet_automated_latest_content_display_options
animation-slide-open-downwards()

View File

@ -30,3 +30,8 @@ $block-hover-highlight-color = $primary-active-color
.mailpoet_content
position: relative
.mailpoet_block_transition_in
animation-fade-in-and-scale-up()
.mailpoet_block_transition_out
animation-fade-out-and-scale-down()

View File

@ -79,3 +79,4 @@ $three-column-width = ($newsletter-width / 3) - (2 * $column-margin)
box-shadow(inset 1px 2px 1px $primary-inactive-color)
color: #656565
border-radius(3px)
animation-background-color()

View File

@ -15,7 +15,11 @@
.mailpoet_posts_categories_and_tags
width: 100%
.mailpoet_settings_posts_show_display_options
.mailpoet_settings_posts_display_options
.mailpoet_settings_posts_selection
animation-slide-open-downwards()
.mailpoet_settings_posts_show_display_options,
.mailpoet_settings_posts_show_post_selection
display: block
margin-top: 10px

View File

@ -0,0 +1,53 @@
animation-slide-open-downwards()
transition: all 300ms cubic-bezier(0.420, 0.000, 0.580, 1.000) /* ease-in-out */
max-height: 2000px
opacity: 1
&.mailpoet_closed
max-height: 0
opacity: 0
overflow-y: hidden
animation-background-color()
transition: background 300ms cubic-bezier(0.420, 0.000, 0.580, 1.000) /* ease-in-out */
animation-fade-in-and-scale-up()
animation-name: fadeInAndScaleUp
animation-duration: 500ms
animation-fill-mode: forwards
animation-fade-out-and-scale-down()
animation-name: fadeOutAndScaleDown
animation-duration: 500ms
animation-fill-mode: forwards
animation-fade-in-and-scale-horizontally()
transition: all 300ms cubic-bezier(0.420, 0.000, 0.580, 1.000) /* ease-in-out */
@keyframes fadeInAndScaleUp {
0% {
opacity: 0.3
max-height: 0
overflow: hidden
}
100% {
opacity: 1
max-height: 5000px
overflow: hidden
}
}
@keyframes fadeOutAndScaleDown {
0% {
opacity: 1
max-height: 5000px
overflow: hidden
}
100% {
opacity: 0.3
max-height: 0
overflow: hidden
}
}

View File

@ -6,6 +6,7 @@
@require 'mixins/border-radius'
@require 'mixins/box-shadow'
@require 'mixins/filter-shadow'
@require 'mixins/transitions'
@require 'variables'
@require 'common'

View File

@ -226,11 +226,11 @@ define([
toggleDisplayOptions: function(event) {
var el = this.$('.mailpoet_automated_latest_content_display_options'),
showControl = this.$('.mailpoet_automated_latest_content_show_display_options');
if (el.hasClass('mailpoet_hidden')) {
el.removeClass('mailpoet_hidden');
if (el.hasClass('mailpoet_closed')) {
el.removeClass('mailpoet_closed');
showControl.addClass('mailpoet_hidden');
} else {
el.addClass('mailpoet_hidden');
el.addClass('mailpoet_closed');
showControl.removeClass('mailpoet_hidden');
}
},

View File

@ -48,6 +48,7 @@ define([
},
modelEvents: {
'change': 'render',
'delete': 'deleteBlock',
},
events: {
"mouseenter": "showTools",
@ -88,7 +89,9 @@ define([
this.$el.addClass('mailpoet_editor_view_' + this.cid);
},
initialize: function() {
this.on('showSettings', this.showSettings);
this.on('showSettings', this.showSettings, this);
this.on('dom:refresh', this.showBlock, this);
this._isFirstRender = true;
},
showTools: function(_event) {
if (!this.showingToolsDisabled) {
@ -121,6 +124,34 @@ define([
return newModel;
};
},
showBlock: function() {
if (this._isFirstRender) {
this.transitionIn();
this._isFirstRender = false;
}
},
deleteBlock: function() {
this.transitionOut().done(function() {
this.model.destroy();
}.bind(this));
},
transitionIn: function() {
return this._transition('mailpoet_block_transition_in');
},
transitionOut: function() {
return this._transition('mailpoet_block_transition_out');
},
_transition: function(className) {
var that = this,
promise = jQuery.Deferred();
this.$el.addClass(className);
this.$el.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd animationend', function() {
that.$el.removeClass('mailpoet_block_transition_out');
promise.resolve();
});
return promise;
},
});
Module.BlockToolsView = AugmentedView.extend({
@ -168,9 +199,9 @@ define([
},
deleteBlock: function(event) {
event.preventDefault();
this.model.destroy();
this.model.trigger('delete');
return false;
}
},
});
Module.BlockSettingsView = Marionette.LayoutView.extend({

View File

@ -42,16 +42,12 @@ define([
Module.ButtonBlockView = base.BlockView.extend({
className: "mailpoet_block mailpoet_button_block mailpoet_droppable_block",
getTemplate: function() { return templates.buttonBlock; },
modelEvents: {
'change': 'render',
},
onDragSubstituteBy: function() { return Module.ButtonWidgetView; },
initialize: function() {
base.BlockView.prototype.initialize.apply(this, arguments);
var that = this;
// Listen for attempts to change all dividers in one go
this._replaceButtonStylesHandler = function(data) { that.model.set(data); };
this._replaceButtonStylesHandler = function(data) { this.model.set(data); }.bind(this);
App.getChannel().on('replaceAllButtonStyles', this._replaceButtonStylesHandler);
},
onRender: function() {

View File

@ -75,7 +75,8 @@ define([
getEmptyView: function() { return Module.ContainerBlockEmptyView; },
emptyViewOptions: function() { return { renderOptions: this.renderOptions }; },
modelEvents: {
'change': 'render'
'change': 'render',
'delete': 'deleteBlock',
},
events: {
"mouseenter": "showTools",
@ -136,6 +137,8 @@ define([
},
initialize: function(options) {
this.renderOptions = _.defaults(options.renderOptions || {}, {});
this.on('dom:refresh', this.showBlock, this);
this._isFirstRender = true;
},
// Determines which view type should be used for a child
getChildView: function(model) {
@ -236,6 +239,34 @@ define([
return newModel;
};
},
showBlock: function() {
if (this._isFirstRender) {
this.transitionIn();
this._isFirstRender = false;
}
},
deleteBlock: function() {
this.transitionOut().done(function() {
this.model.destroy();
}.bind(this));
},
transitionIn: function() {
return this._transition('mailpoet_block_transition_in');
},
transitionOut: function() {
return this._transition('mailpoet_block_transition_out');
},
_transition: function(className) {
var that = this,
promise = jQuery.Deferred();
this.$el.addClass(className);
this.$el.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd animationend', function() {
that.$el.removeClass('mailpoet_block_transition_out');
promise.resolve();
});
return promise;
},
});
Module.ContainerBlockEmptyView = Marionette.ItemView.extend({

View File

@ -222,8 +222,8 @@ define([
},
switchToDisplayOptions: function() {
// Switch content view
this.$('.mailpoet_settings_posts_selection').addClass('mailpoet_hidden');
this.$('.mailpoet_settings_posts_display_options').removeClass('mailpoet_hidden');
this.$('.mailpoet_settings_posts_selection').addClass('mailpoet_closed');
this.$('.mailpoet_settings_posts_display_options').removeClass('mailpoet_closed');
// Switch controls
this.$('.mailpoet_settings_posts_show_display_options').addClass('mailpoet_hidden');
@ -231,8 +231,8 @@ define([
},
switchToPostSelection: function() {
// Switch content view
this.$('.mailpoet_settings_posts_display_options').addClass('mailpoet_hidden');
this.$('.mailpoet_settings_posts_selection').removeClass('mailpoet_hidden');
this.$('.mailpoet_settings_posts_display_options').addClass('mailpoet_closed');
this.$('.mailpoet_settings_posts_selection').removeClass('mailpoet_closed');
// Switch controls
this.$('.mailpoet_settings_posts_show_post_selection').addClass('mailpoet_hidden');

View File

@ -103,7 +103,8 @@ define([
getTemplate: function() { return templates.socialBlock; },
childViewContainer: '.mailpoet_social',
modelEvents: {
'change': 'render'
'change': 'render',
'delete': 'deleteBlock',
},
events: {
"mouseover": "showTools",
@ -145,6 +146,10 @@ define([
arguments[0].collection = arguments[0].model.get('icons');
Marionette.CompositeView.apply(this, arguments);
},
initialize: function() {
this.on('dom:refresh', this.showBlock, this);
this._isFirstRender = true;
},
// Determines which view type should be used for a child
childView: SocialIconView,
templateHelpers: function() {
@ -194,6 +199,34 @@ define([
this.regionManager.destroy();
_.extend(this, this._buildRegions(this.regions));
},
showBlock: function() {
if (this._isFirstRender) {
this.transitionIn();
this._isFirstRender = false;
}
},
deleteBlock: function() {
this.transitionOut().done(function() {
this.model.destroy();
}.bind(this));
},
transitionIn: function() {
return this._transition('mailpoet_block_transition_in');
},
transitionOut: function() {
return this._transition('mailpoet_block_transition_out');
},
_transition: function(className) {
var that = this,
promise = jQuery.Deferred();
this.$el.addClass(className);
this.$el.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd animationend', function() {
that.$el.removeClass('mailpoet_block_transition_out');
promise.resolve();
});
return promise;
},
});
Module.SocialBlockToolsView = base.BlockToolsView.extend({

View File

@ -47,18 +47,34 @@ define([
});
};
Module.getThumbnail = function(element, options) {
return html2canvas(element, options || {});
};
Module.saveTemplate = function(options) {
var that = this,
promise = jQuery.Deferred();
promise.then(function(thumbnail) {
var data = _.extend(options || {}, {
thumbnail: thumbnail.toDataURL('image/jpeg'),
body: App.getBody(),
});
return MailPoet.Ajax.post({
endpoint: 'newsletterTemplates',
action: 'save',
data: _.extend(options || {}, {
body: App.getBody(),
}),
data: data,
});
});
};
Module.getThumbnail = function(element, options) {
return html2canvas(element, options || {});
Module.getThumbnail(
jQuery('#mailpoet_editor_content > .mailpoet_block').get(0)
).then(function(thumbnail) {
promise.resolve(thumbnail);
});
return promise;
};
Module.exportTemplate = function(options) {

View File

@ -99,7 +99,7 @@ define(
"MailPoet's Guide",
description:
"This is the standard template that comes with MailPoet.",
readonly: true
readonly: "1"
}
]
}
@ -210,7 +210,7 @@ define(
Preview
</a>
</div>
{ (template.readonly) ? false : deleteLink }
{ (template.readonly === "1") ? false : deleteLink }
</li>
);
}.bind(this));

View File

@ -131,10 +131,12 @@ const item_actions = [
label: 'Update',
className: 'update',
onClick: function(item, refresh) {
return MailPoet.Ajax.post({
MailPoet.Modal.loading(true);
MailPoet.Ajax.post({
endpoint: 'segments',
action: 'synchronize'
}).done(function(response) {
MailPoet.Modal.loading(false);
if(response === true) {
MailPoet.Notice.success(
('List "%$1s" has been synchronized.').replace('%$1s', item.name)

View File

@ -99,8 +99,9 @@ class Migrator {
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'name varchar(250) NOT NULL,',
'description varchar(250) NOT NULL,',
'body longtext,',
'thumbnail longtext,',
'body LONGTEXT,',
'thumbnail LONGTEXT,',
'readonly TINYINT(1) DEFAULT 0',
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id)'

View File

@ -1,7 +1,10 @@
<?php
namespace MailPoet\Config;
use MailPoet\Config\PopulatorData\Templates\SampleTemplate;
use MailPoet\Config\PopulatorData\Templates\FranksRoastHouseTemplate;
use MailPoet\Config\PopulatorData\Templates\BlankTemplate;
use \MailPoet\Models\Segment;
use \MailPoet\Segments\WP;
if (!defined('ABSPATH')) exit;
@ -39,6 +42,39 @@ class Populator {
};
array_map(array($this, 'populate'), $this->models);
$this->createDefaultSegments();
}
private function createDefaultSegments() {
// WP Users segment
$wp_users_segment = Segment::getWPUsers();
if($wp_users_segment === false) {
// create the wp users list
$wp_users_segment = Segment::create();
$wp_users_segment->hydrate(array(
'name' => __('WordPress Users'),
'description' =>
__('The list containing all of your WordPress users.'),
'type' => 'wp_users'
));
$wp_users_segment->save();
}
// Synchronize WP Users
WP::synchronizeUsers();
// Default segment
if(Segment::where('type', 'default')->count() === 0) {
$default_segment = Segment::create();
$default_segment->hydrate(array(
'name' => __('My First List'),
'description' =>
__('The list created automatically on install of MailPoet')
));
$default_segment->save();
}
}
function newsletter_option_fields() {
@ -89,7 +125,8 @@ class Populator {
private function newsletter_templates() {
return array(
(new SampleTemplate(Env::$assets_url))->get(),
(new FranksRoastHouseTemplate(Env::$assets_url))->get(),
(new BlankTemplate(Env::$assets_url))->get(),
);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -63,8 +63,12 @@ class Daemon {
$this->abortWithError('invalid token');
}
try {
$worker = new Worker($this->timer);
$worker->process();
} catch(Exception $e) {
}
$elapsedTime = microtime(true) - $this->timer;
if($elapsedTime < 30) {
sleep(30 - $elapsedTime);
@ -76,7 +80,7 @@ class Daemon {
$daemonData['token'] = $this->refreshedToken;
$daemon->value = json_encode($daemonData);
$daemon->save();
$this->callSelf();
if($daemonData['status'] === 'strated') $this->callSelf();
}
function getDaemon() {

View File

@ -4,8 +4,8 @@ namespace MailPoet\Cron;
use MailPoet\Models\Newsletter;
use MailPoet\Models\NewsletterStatistics;
use MailPoet\Models\SendingQueue;
use MailPoet\Models\Setting;
use MailPoet\Models\Subscriber;
use MailPoet\Newsletter\Renderer\Renderer;
use MailPoet\Router\Mailer;
if(!defined('ABSPATH')) exit;
@ -21,25 +21,21 @@ class Worker {
->whereNull('deleted_at')
->whereNull('status')
->findResultSet();
// TODO: usee Mailer's method to get the mailer from DB
$mailer = new Mailer();
$mailer->mailer['method'] = 'MailPoet';
$mailer->mailer['class'] = 'MailPoet\\Mailer\\MailPoet';
$mailer->mailer['api_key'] = Setting::getValue('api_key', 'dhNSqj1XHkVltIliyQDvMiKzQShOA5rs0m_DdRUVZHU');
$mailerMethod = $mailer->buildMailer();
foreach($queues as $queue) {
if($this->checkExecutionTimer()) break;
$newsletter = Newsletter::findOne($queue->newsletter_id);
if(!$newsletter) {
continue;
};
$newsletter = $newsletter->asArray();
// TODO: render newsletter
$renderer = new Renderer(json_decode($newsletter['body'], true));
$newsletter = array(
'subject' => $newsletter['subject'],
'id' => $newsletter['id'],
'body' => array(
'html' => 'rendering not yet implemented',
'text' => 'rendering not yet implemented'
'html' => $renderer->renderAll(),
'text' => '' // TODO: add text body
)
);
$subscribers = json_decode($queue->subscribers, true);
@ -47,20 +43,14 @@ class Worker {
if(!isset($subscribers['failed'])) $subscribers['failed'] = array();
if(!isset($subscribers['processed'])) $subscribers['processed'] = array();
foreach(array_chunk($subscribersToProcess, 200) as $subscriberIds) {
if($this->checkExecutionTimer()) break;
$dbSubscribers = Subscriber::whereIn('id', $subscriberIds)
->findArray();
foreach($dbSubscribers as $i => $dbSubscriber) {
if($this->checkExecutionTimer()) break;
$this->checkExecutionTimer();
// TODO: replace shortcodes in the newsletter
$result = $mailer->send(
$result = $mailerMethod->send(
$newsletter,
sprintf(
"%s %s <%s>",
$dbSubscriber['first_name'],
$dbSubscriber['last_name'],
$dbSubscriber['email']
)
$mailer->transformSubscriber($dbSubscriber)
);
$newsletterStatistics = NewsletterStatistics::create();
$newsletterStatistics->subscriber_id = $dbSubscriber['id'];
@ -97,6 +87,6 @@ class Worker {
function checkExecutionTimer() {
$elapsedTime = microtime(true) - $this->timer;
return ($elapsedTime >= 28) ? true : false;
if ($elapsedTime >= 28) throw new \Exception('Maximum execution time reached.');
}
}

View File

@ -77,20 +77,7 @@ class Segment extends Model {
}
static function getWPUsers() {
$segment = self::where('type', 'wp_users')->findOne();
if($segment === false) {
// create the wp users list
$segment = self::create();
$segment->hydrate(array(
'name' => __('WordPress Users'),
'type' => 'wp_users'
));
$segment->save();
return self::findOne($segment->id());
}
return $segment;
return self::where('type', 'wp_users')->findOne();
}
static function search($orm, $search = '') {

View File

@ -9,9 +9,20 @@ if(!defined('ABSPATH')) exit;
class Mailer {
function __construct() {
list($this->fromName, $this->fromEmail) = $this->getSetting('sender');
list($this->fromName, $this->fromEmail, $this->fromNameEmail)
= $this->getSetting('sender');
$this->mailerType = array(
'AmazonSES' => 'API',
'ElasticEmail' => 'API',
'MailGun' => 'API',
'Mandrill' => 'API',
'SendGrid' => 'API',
'MailPoet' => null,
'SMTP' => null,
'WPMail' => null
);
$this->mailer = $this->getSetting('mailer');
$this->from = sprintf('%s <%s>', $this->fromName, $this->fromEmail);
}
function send($newsletter, $subscriber) {
@ -27,7 +38,7 @@ class Mailer {
$this->mailer['region'],
$this->mailer['access_key'],
$this->mailer['secret_key'],
$this->from
$this->fromNameEmail
);
break;
case 'ElasticEmail':
@ -40,7 +51,7 @@ class Mailer {
$mailer = new $this->mailer['class'](
$this->mailer['domain'],
$this->mailer['api_key'],
$this->from
$this->fromNameEmail
);
break;
case 'MailPoet':
@ -63,6 +74,12 @@ class Mailer {
$this->fromName
);
break;
case 'WPMail':
$mailer = new $this->mailer['class'](
$this->fromEmail,
$this->fromName
);
break;
case 'SMTP':
$mailer = new $this->mailer['class'](
$this->mailer['host'],
@ -70,7 +87,11 @@ class Mailer {
$this->mailer['authentication'],
$this->mailer['encryption'],
$this->fromEmail,
$this->fromName);
$this->fromName
);
break;
default:
throw new \Exception('Mailing method does not exist.');
break;
}
return $mailer;
@ -89,66 +110,23 @@ class Mailer {
function getSetting($setting) {
switch($setting) {
case 'mailer':
// TODO: remove
/* $mailers = array(
array(
'method' => 'AmazonSES',
'type' => 'API',
'access_key' => 'AKIAJM6Y5HMGXBLDNSRA',
'secret_key' => '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',
'region' => 'us-east-1'
),
array(
'method' => 'ElasticEmail',
'type' => 'API',
'api_key' => '997f1f7f-41de-4d7f-a8cb-86c8481370fa'
),
array(
'method' => 'MailGun',
'type' => 'API',
'api_key' => 'key-6cf5g5qjzenk-7nodj44gdt8phe6vam2',
'domain' => 'mrcasual.com'
),
array(
'method' => 'MailPoet',
'api_key' => 'dhNSqj1XHkVltIliyQDvMiKzQShOA5rs0m_DdRUVZHU'
),
array(
'method' => 'Mandrill',
'type' => 'API',
'api_key' => '692ys1B7REEoZN7R-dYwNA'
),
array(
'method' => 'SendGrid',
'type' => 'API',
'api_key' => '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'
),
array(
'method' => 'SMTP',
'host' => 'email-smtp.us-west-2.amazonaws.com',
'port' => 587,
'authentication' => array(
'login' => 'AKIAIGPBLH6JWG5VCBQQ',
'password' => 'AudVHXHaYkvr54veCzqiqOxDiMMyfQW3/V6F1tYzGXY3'
),
'encryption' => 'tls'
),
array(
'method' => 'WPMail'
)
);*/
$mailer = Setting::getValue('mta', null);
if(!$mailer) throw new \Exception('Mailing method has not been configured.');
if(!$mailer || !isset($mailer['method'])) throw new \Exception('Mailing method is not configured.');
$mailer['class'] = 'MailPoet\\Mailer\\' .
((isset($mailer['type'])) ?
$mailer['type'] . '\\' . $mailer['method'] :
(($this->mailerType[$mailer['method']]) ?
$this->mailerType[$mailer['method']] . '\\' . $mailer['method'] :
$mailer['method']
);
return $mailer;
break;;
case 'sender':
$sender = Setting::getValue($setting, null);
return array($sender['name'], $sender['address']);
if(!$sender) throw new \Exception('Sender name and email are not configured.');
return array(
$sender['name'],
$sender['address'],
sprintf('%s <%s>', $sender['name'], $sender['address'])
);
break;
default:
return Setting::getValue($setting, null);

View File

@ -6,7 +6,9 @@ use \MailPoet\Models\Segment;
class WP {
static function synchronizeUser($wp_user_id) {
$wpUser = \get_userdata($wp_user_id);
if($wpUser === false) return;
$segment = Segment::getWPUsers();
if($wpUser === false or $segment === false) return;
$subscriber = Subscriber::where('wp_user_id', $wpUser->ID)
->findOne();
@ -46,9 +48,10 @@ class WP {
$subscriber = Subscriber::createOrUpdate($data);
if($subscriber !== false && $subscriber->id()) {
$segment = Segment::getWPUsers();
if($segment !== false) {
$segment->addSubscriber($subscriber->id());
}
}
break;
}
}

View File

@ -10,7 +10,7 @@
},
"dependencies": {
"backbone": "1.2.3",
"backbone.marionette": "2.4.3",
"backbone.marionette": "2.4.4",
"backbone.radio": "0.9.0",
"backbone.supermodel": "1.2.0",
"c3": "~0.4.10",

View File

@ -96,7 +96,13 @@ define([
});
it('triggers template saving when clicked on save as template button', function() {
var mock = sinon.mock({ post: function() {} }).expects('post').once().returns(jQuery.Deferred());
var mock = sinon.mock({ post: function() {} }).expects('post').once().returns(jQuery.Deferred()),
html2canvasMock = jQuery.Deferred();
html2canvasMock.resolve({
toDataURL: function() { return 'somedataurl'; },
});
EditorApplication.getBody = sinon.stub();
var module = SaveInjector({
'mailpoet': {
@ -105,6 +111,7 @@ define([
}
},
'newsletter_editor/App': EditorApplication,
'html2canvas': function() { return html2canvasMock; },
});
var view = new (module.SaveView)();
view.render();

View File

@ -41,7 +41,7 @@
<div class="mailpoet_form_field">
<a href="javascript:;" class="mailpoet_automated_latest_content_show_display_options"><%= __('Display options') %></a>
</div>
<div class="mailpoet_automated_latest_content_display_options mailpoet_hidden">
<div class="mailpoet_automated_latest_content_display_options mailpoet_closed">
<div class="mailpoet_form_field">
<a href="javascript:;" class="mailpoet_automated_latest_content_hide_display_options"><%= __('Hide display options') %></a>
</div>

View File

@ -2,12 +2,6 @@
<%= source('newsletter/templates/svg/block-tools/settings-column.svg') %>
</a>{{/if}}{{#if tools.settings}}<a href="javascript:;" class="mailpoet_tool mailpoet_edit_block" title="<%= __('Edit settings') %>">
<%= source('newsletter/templates/svg/block-tools/settings.svg') %>
</a>{{/if}}{{#if tools.delete}}<div class="mailpoet_delete_block">
<a href="javascript:;" class="mailpoet_tool mailpoet_delete_block_activate" title="<%= __('Delete') %>">
<%= source('newsletter/templates/svg/block-tools/trash.svg') %>
</a>
<a href="javascript:;" class="mailpoet_delete_block_confirm" title="<%= __('Confirm deletion') %>"><%= __('Delete') %></a>
<a href="javascript:;" class="mailpoet_delete_block_cancel" title="<%= __('Cancel deletion') %>"><%= __('Cancel') %></a>
</div>{{/if}}{{#if tools.move}}<a href="javascript:;" class="mailpoet_tool mailpoet_move_block" title="<%= __('Drag to move') %>">
</a>{{/if}}{{#if tools.delete}}<div class="mailpoet_delete_block"><a href="javascript:;" class="mailpoet_tool mailpoet_delete_block_activate" title="<%= __('Delete') %>"><%= source('newsletter/templates/svg/block-tools/trash.svg') %></a><a href="javascript:;" class="mailpoet_delete_block_confirm" title="<%= __('Confirm deletion') %>"><%= __('Delete') %></a><a href="javascript:;" class="mailpoet_delete_block_cancel" title="<%= __('Cancel deletion') %>"><%= __('Cancel') %></a></div>{{/if}}{{#if tools.move}}<a href="javascript:;" class="mailpoet_tool mailpoet_move_block" title="<%= __('Drag to move') %>">
<%= source('newsletter/templates/svg/block-tools/move.svg') %>
</a>{{/if}}<div class="clearfix"></div>

View File

@ -1,6 +1,6 @@
<h3><%= __('Post selection') %></h3>
<div class="mailpoet_settings_posts_selection"></div>
<div class="mailpoet_settings_posts_display_options mailpoet_hidden"></div>
<div class="mailpoet_settings_posts_display_options mailpoet_closed"></div>
<div class="mailpoet_settings_posts_controls">
<div class="mailpoet_form_field">
<a href="javascript:;" class="mailpoet_settings_posts_show_post_selection mailpoet_hidden"><%= __('Back to selection') %></a>