diff --git a/.eslintrc.es5.json b/.eslintrc.es5.json
index 90b07853bb..99a44b7e15 100644
--- a/.eslintrc.es5.json
+++ b/.eslintrc.es5.json
@@ -36,7 +36,6 @@
"no-lonely-if": 0,
"no-mixed-operators": 0,
"eqeqeq": 0,
- "max-len": 0,
"brace-style": 0,
"space-infix-ops": 0
}
diff --git a/assets/js/src/form_editor/form_editor.js b/assets/js/src/form_editor/form_editor.js
index 83104e5b91..9d7b35d8d4 100644
--- a/assets/js/src/form_editor/form_editor.js
+++ b/assets/js/src/form_editor/form_editor.js
@@ -19,7 +19,31 @@ function info(value) {
if (!(window.console && console.log)) {
(function () {
var noop = function () {};
- var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'markTimeline', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
+ var methods = [
+ 'assert',
+ 'clear',
+ 'count',
+ 'debug',
+ 'dir',
+ 'dirxml',
+ 'error',
+ 'exception',
+ 'group',
+ 'groupCollapsed',
+ 'groupEnd',
+ 'info',
+ 'log',
+ 'markTimeline',
+ 'profile',
+ 'profileEnd',
+ 'markTimeline',
+ 'table',
+ 'time',
+ 'timeEnd',
+ 'timeStamp',
+ 'trace',
+ 'warn'
+ ];
var length = methods.length;
var console = {};
window.console = {};
@@ -186,7 +210,9 @@ Object.extend(window.Droppables, {
if (this.last_active && this.last_active !== drop) this.deactivate(this.last_active, element);
if (drop) {
window.Position.within(drop.element, point[0], point[1]);
- if (drop.onHover) drop.onHover(element, drop.element, window.Position.overlap(drop.overlap, drop.element));
+ if (drop.onHover) {
+ drop.onHover(element, drop.element, window.Position.overlap(drop.overlap, drop.element));
+ }
if (drop !== this.last_active) window.Droppables.activate(drop, element);
}
},
@@ -358,11 +384,16 @@ WysijaForm = {
},
save: function () {
var position = 1;
- var data = {
+ var styles = null;
+ var data;
+ if (window.MailPoet.CodeEditor !== undefined) {
+ styles = window.MailPoet.CodeEditor.getValue();
+ }
+ data = {
name: window.$F('mailpoet_form_name'),
settings: window.$('mailpoet_form_settings').serialize(true),
body: [],
- styles: (window.MailPoet.CodeEditor !== undefined) ? window.MailPoet.CodeEditor.getValue() : null
+ styles: styles
};
// body
WysijaForm.getBlocks().each(function (b) {
@@ -437,9 +468,12 @@ WysijaForm = {
var hasSegmentSelection;
window.$$('a[wysija_unique="1"]').invoke('removeClassName', 'disabled');
- // loop through each unique field already inserted in the editor and disable its toolbar equivalent
+ // loop through each unique field already inserted in the editor
+ // and disable its toolbar equivalent
window.$$('#' + WysijaForm.options.editor + ' [wysija_unique="1"]').map(function (element) {
- var field = window.$$('#' + WysijaForm.options.toolbar + ' [wysija_id="' + element.readAttribute('wysija_id') + '"]');
+ var field = window.$$(
+ '#' + WysijaForm.options.toolbar + ' [wysija_id="' + element.readAttribute('wysija_id') + '"]'
+ );
if (field.length > 0) {
field.first().addClassName('disabled');
}
@@ -538,15 +572,30 @@ WysijaForm = {
});
},
initToolbarPosition: function () {
- if (WysijaForm.toolbar.top === null) WysijaForm.toolbar.top = parseInt(window.$(WysijaForm.options.container).positionedOffset().top);
- if (WysijaForm.toolbar.y === null) WysijaForm.toolbar.y = parseInt(WysijaForm.toolbar.top);
+ if (WysijaForm.toolbar.top === null) {
+ WysijaForm.toolbar.top =
+ parseInt(window.$(WysijaForm.options.container).positionedOffset().top);
+ }
+ if (WysijaForm.toolbar.y === null) {
+ WysijaForm.toolbar.y = parseInt(WysijaForm.toolbar.top);
+ }
if (window.isRtl) {
if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0;
} else {
- if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = parseInt(window.$(WysijaForm.options.container).positionedOffset().left);
+ if (WysijaForm.toolbar.left === null) {
+ WysijaForm.toolbar.left =
+ parseInt(window.$(WysijaForm.options.container).positionedOffset().left);
+ }
+ }
+ if (WysijaForm.toolbar.x === null) {
+ WysijaForm.toolbar.x =
+ parseInt(
+ WysijaForm.toolbar.left
+ + window.$(WysijaForm.options.container).getDimensions().width
+ + 15
+ , 10);
}
- if (WysijaForm.toolbar.x === null) WysijaForm.toolbar.x = parseInt(WysijaForm.toolbar.left + window.$(WysijaForm.options.container).getDimensions().width + 15);
},
setToolbarPosition: function () {
var position;
@@ -847,7 +896,11 @@ WysijaForm.Block = window.Class.create({
// setup events for block controls
this.element.observe('mouseover', function () {
// special cases where controls shouldn't be displayed
- if (WysijaForm.locks.dragging === true || WysijaForm.locks.selectingColor === true || WysijaForm.locks.showingTools === true) return;
+ if (
+ WysijaForm.locks.dragging === true
+ || WysijaForm.locks.selectingColor === true
+ || WysijaForm.locks.showingTools === true
+ ) return;
// set block flag
this.element.addClassName('hover');
diff --git a/assets/js/src/modal.js b/assets/js/src/modal.js
index d6d30c7db5..1f9b57513e 100644
--- a/assets/js/src/modal.js
+++ b/assets/js/src/modal.js
@@ -555,7 +555,9 @@ define('modal', ['mailpoet', 'jquery'],
success: function () {
if (this.subpanels.length > 0) {
if (this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) {
- this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
+ this
+ .subpanels[(this.subpanels.length - 1)]
+ .onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
}
} else {
if (this.options.onSuccess !== null) {
@@ -569,7 +571,9 @@ define('modal', ['mailpoet', 'jquery'],
cancel: function () {
if (this.subpanels.length > 0) {
if (this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) {
- this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data);
+ this
+ .subpanels[(this.subpanels.length - 1)]
+ .onCancel(this.subpanels[(this.subpanels.length - 1)].data);
}
} else {
if (this.options.onCancel !== null) {
diff --git a/assets/js/src/mp2migrator.js b/assets/js/src/mp2migrator.js
index 105e48acd4..302d44b64d 100644
--- a/assets/js/src/mp2migrator.js
+++ b/assets/js/src/mp2migrator.js
@@ -46,7 +46,8 @@ define('mp2migrator', ['mailpoet', 'jquery'], function (mp, jQuery) {
jQuery('#logger').append('' + MailPoet.MP2Migrator.fatal_error + '' + '
\n');
}).always(function () {
if (MailPoet.MP2Migrator.is_logging) {
- MailPoet.MP2Migrator.displayLogs_timeout = setTimeout(MailPoet.MP2Migrator.displayLogs, 1000);
+ MailPoet.MP2Migrator.displayLogs_timeout
+ = setTimeout(MailPoet.MP2Migrator.displayLogs, 1000);
}
});
},
@@ -70,7 +71,8 @@ define('mp2migrator', ['mailpoet', 'jquery'], function (mp, jQuery) {
jQuery('#logger-container').show();
}
if (MailPoet.MP2Migrator.is_logging) {
- MailPoet.MP2Migrator.updateProgressbar_timeout = setTimeout(MailPoet.MP2Migrator.updateProgressbar, 1000);
+ MailPoet.MP2Migrator.updateProgressbar_timeout
+ = setTimeout(MailPoet.MP2Migrator.updateProgressbar, 1000);
}
});
},
@@ -97,7 +99,8 @@ define('mp2migrator', ['mailpoet', 'jquery'], function (mp, jQuery) {
}
}).always(function () {
MailPoet.MP2Migrator.stopLogger();
- MailPoet.MP2Migrator.updateDisplay(); // Get the latest information after the import was stopped
+ // Get the latest information after the import was stopped
+ MailPoet.MP2Migrator.updateDisplay();
MailPoet.MP2Migrator.reactivateImportButton();
}).done(function (response) {
if (response) {
@@ -133,7 +136,8 @@ define('mp2migrator', ['mailpoet', 'jquery'], function (mp, jQuery) {
}).always(function () {
jQuery('#stop-import').removeAttr('disabled'); // Enable the button
MailPoet.MP2Migrator.reactivateImportButton();
- MailPoet.MP2Migrator.updateDisplay(); // Get the latest information after the import was stopped
+ // Get the latest information after the import was stopped
+ MailPoet.MP2Migrator.updateDisplay();
}).fail(function (response) {
if (response.errors.length > 0) {
MailPoet.Notice.error(
diff --git a/assets/js/src/newsletter_editor/behaviors/ContainerDropZoneBehavior.js b/assets/js/src/newsletter_editor/behaviors/ContainerDropZoneBehavior.js
index 9b240b5d33..052738a9ed 100644
--- a/assets/js/src/newsletter_editor/behaviors/ContainerDropZoneBehavior.js
+++ b/assets/js/src/newsletter_editor/behaviors/ContainerDropZoneBehavior.js
@@ -20,7 +20,9 @@ define([
columnLimit: 3
},
onRender: function () {
- var dragAndDropDisabled = _.isObject(this.view.options.renderOptions) && this.view.options.renderOptions.disableDragAndDrop === true;
+ var dragAndDropDisabled =
+ _.isObject(this.view.options.renderOptions)
+ && this.view.options.renderOptions.disableDragAndDrop === true;
if (!dragAndDropDisabled) {
this.addDropZone();
}
@@ -60,8 +62,11 @@ define([
// 1. Compute actual location of the mouse within the container
// 2. Check if insertion is regular (between blocks) or special (with container insertion)
// 3a. If insertion is regular, compute position where insertion should happen
- // 3b. If insertion is special, compute position (which side) and which cell the insertion belongs to
- // 4. If insertion at that position is not visualized, display position visualization there, remove other visualizations from this container
+ // 3b. If insertion is special,
+ // compute position (which side) and which cell the insertion belongs to
+ // 4. If insertion at that position is not visualized,
+ // display position visualization there,
+ // remove other visualizations from this container
var dropPosition = that.getDropPosition(
event.dragmove.pageX,
event.dragmove.pageY,
@@ -99,7 +104,11 @@ define([
markerHeight = targetElement.height();
} else {
isLastBlockInsertion = that.getCollection().length === dropPosition.index;
- targetModel = isLastBlockInsertion ? viewCollection.at(dropPosition.index - 1) : viewCollection.at(dropPosition.index);
+ if (isLastBlockInsertion) {
+ targetModel = viewCollection.at(dropPosition.index - 1);
+ } else {
+ targetModel = viewCollection.at(dropPosition.index);
+ }
targetView = that.getChildren().findByModel(targetModel);
targetElement = targetView.$el;
@@ -156,9 +165,15 @@ define([
// compensated for to position marker right in the middle of two
// blocks
if (dropPosition.position === 'before') {
- $targetBlock = that.getChildren().findByModel(viewCollection.at(dropPosition.index - 1)).$el;
+ $targetBlock = that
+ .getChildren()
+ .findByModel(viewCollection.at(dropPosition.index - 1))
+ .$el;
} else {
- $targetBlock = that.getChildren().findByModel(viewCollection.at(dropPosition.index)).$el;
+ $targetBlock = that
+ .getChildren()
+ .findByModel(viewCollection.at(dropPosition.index))
+ .$el;
}
margin = $targetBlock.outerHeight(true) - $targetBlock.outerHeight();
@@ -179,7 +194,8 @@ define([
// 3b1. compute position (which side) and which cell the insertion belongs to
// 3b2. remove element at that position from the collection
// 3b3. create a new collection, insert the removed element to it
- // 3b4. insert the droppable model at the start or end of the new collection, depending on 3b1. position
+ // 3b4. insert the droppable model at the start or end of the new collection,
+ // depending on 3b1. position
// 3b5. insert the new collection into the old collection to cell from 3b1.
// 4. Perform cleanup actions
@@ -260,7 +276,11 @@ define([
viewCollection.add(tempCollection, { at: dropPosition.index });
// Call post add actions
- droppedView = that.getChildren().findByModel(tempCollection).children.findByModel(droppableModel);
+ droppedView = that
+ .getChildren()
+ .findByModel(tempCollection)
+ .children
+ .findByModel(droppableModel);
}
// Call post add actions
@@ -331,11 +351,17 @@ define([
SPECIAL_AREA_INSERTION_WIDTH = 0.5;
}
- if (relativeOffset <= elementLength * SPECIAL_AREA_INSERTION_WIDTH && (unsafe || canAcceptSpecialInsertion)) {
+ if (
+ relativeOffset <= elementLength * SPECIAL_AREA_INSERTION_WIDTH
+ && (unsafe || canAcceptSpecialInsertion)
+ ) {
insertionType = 'special';
position = 'before';
index = this._computeSpecialIndex(eventX, eventY);
- } else if (relativeOffset > elementLength * (1 - SPECIAL_AREA_INSERTION_WIDTH) && (unsafe || canAcceptSpecialInsertion)) {
+ } else if (
+ relativeOffset > elementLength * (1 - SPECIAL_AREA_INSERTION_WIDTH)
+ && (unsafe || canAcceptSpecialInsertion)
+ ) {
insertionType = 'special';
position = 'after';
index = this._computeSpecialIndex(eventX, eventY);
diff --git a/assets/js/src/newsletter_editor/behaviors/DraggableBehavior.js b/assets/js/src/newsletter_editor/behaviors/DraggableBehavior.js
index 2806446d4b..512de5bb6c 100644
--- a/assets/js/src/newsletter_editor/behaviors/DraggableBehavior.js
+++ b/assets/js/src/newsletter_editor/behaviors/DraggableBehavior.js
@@ -57,7 +57,9 @@ define([
if (that.options.cloneOriginal === true) {
// Use substitution instead of a clone
- tempClone = (_.isFunction(that.options.onDragSubstituteBy)) ? that.options.onDragSubstituteBy(that) : undefined;
+ if (_.isFunction(that.options.onDragSubstituteBy)) {
+ tempClone = that.options.onDragSubstituteBy(that);
+ }
// Or use a clone
clone = tempClone || event.target.cloneNode(true);
jQuery(event.target);
diff --git a/assets/js/src/newsletter_editor/behaviors/ResizableBehavior.js b/assets/js/src/newsletter_editor/behaviors/ResizableBehavior.js
index 6cf41ee000..4e7144044b 100644
--- a/assets/js/src/newsletter_editor/behaviors/ResizableBehavior.js
+++ b/assets/js/src/newsletter_editor/behaviors/ResizableBehavior.js
@@ -14,7 +14,8 @@ define([
defaults: {
elementSelector: null,
resizeHandleSelector: true, // true will use edges of the element itself
- transformationFunction: function transformationFunction(y) { return y; }, // for blocks that use the default onResize function
+ // for blocks that use the default onResize function
+ transformationFunction: function transformationFunction(y) { return y; },
minLength: 0,
maxLength: Infinity,
modelField: 'styles.block.height',
@@ -37,8 +38,13 @@ define([
}
},
attachResize: function () { // eslint-disable-line func-names
- var domElement = (this.options.elementSelector === null) ? this.view.$el.get(0) : this.view.$(this.options.elementSelector).get(0);
+ var domElement;
var that = this;
+ if (this.options.elementSelector === null) {
+ domElement = this.view.$el.get(0);
+ } else {
+ domElement = this.view.$(this.options.elementSelector).get(0);
+ }
interact(domElement).resizable({
// axis: 'y',
edges: {
diff --git a/assets/js/src/newsletter_editor/behaviors/TextEditorBehavior.js b/assets/js/src/newsletter_editor/behaviors/TextEditorBehavior.js
index 38d6a70baf..cd16200178 100644
--- a/assets/js/src/newsletter_editor/behaviors/TextEditorBehavior.js
+++ b/assets/js/src/newsletter_editor/behaviors/TextEditorBehavior.js
@@ -7,7 +7,7 @@ define([
'backbone.marionette',
'underscore',
'newsletter_editor/behaviors/BehaviorsLookup'
-], function (Marionette, _, BehaviorsLookup) { // eslint-disable-line func-names
+], function textEditorBehavior(Marionette, _, BehaviorsLookup) {
var BL = BehaviorsLookup;
BL.TextEditorBehavior = Marionette.Behavior.extend({
@@ -19,9 +19,9 @@ define([
invalidElements: 'script',
blockFormats: 'Paragraph=p',
plugins: 'link textcolor colorpicker mailpoet_shortcodes',
- configurationFilter: function (originalConfig) { return originalConfig; } // eslint-disable-line func-names
+ configurationFilter: function configurationFilter(originalConfig) { return originalConfig; }
},
- onDomRefresh: function () { // eslint-disable-line func-names
+ onDomRefresh: function onDomRefresh() {
var that = this;
if (this.view.disableTextEditor === true) {
return;
@@ -42,7 +42,7 @@ define([
relative_urls: false,
remove_script_host: false,
convert_urls: true,
- urlconverter_callback: function (url) { // eslint-disable-line func-names
+ urlconverter_callback: function urlconverterCallback(url) {
if (url.match(/\[.+\]/g)) {
// Do not convert URLs with shortcodes
return url;
@@ -56,27 +56,31 @@ define([
plugins: this.options.plugins,
- setup: function (editor) { // eslint-disable-line func-names
- editor.on('change', function () { // eslint-disable-line func-names
+ setup: function setup(editor) {
+ editor.on('change', function onChange() {
that.view.triggerMethod('text:editor:change', editor.getContent());
});
- editor.on('click', function (e) { // eslint-disable-line func-names
+ editor.on('click', function onClick(e) {
editor.focus();
if (that._isActivationClick) {
editor.selection.setRng(
- window.tinymce.dom.RangeUtils.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc())
+ window.tinymce.dom.RangeUtils.getCaretRangeFromPoint(
+ e.clientX,
+ e.clientY,
+ editor.getDoc()
+ )
);
that._isActivationClick = false;
}
});
- editor.on('focus', function () { // eslint-disable-line func-names
+ editor.on('focus', function onFocus() {
that.view.triggerMethod('text:editor:focus');
that._isActivationClick = true;
});
- editor.on('blur', function () { // eslint-disable-line func-names
+ editor.on('blur', function onBlur() {
that.view.triggerMethod('text:editor:blur');
});
}
diff --git a/assets/js/src/newsletter_editor/blocks/automatedLatestContent.js b/assets/js/src/newsletter_editor/blocks/automatedLatestContent.js
index 321eceae01..4b3c158e73 100644
--- a/assets/js/src/newsletter_editor/blocks/automatedLatestContent.js
+++ b/assets/js/src/newsletter_editor/blocks/automatedLatestContent.js
@@ -84,7 +84,6 @@ define([
titleIsLink: false, // false|true
imageFullWidth: false, // true|false
featuredImagePosition: 'belowTitle', // 'aboveTitle'|'belowTitle'|'none'
- // imageAlignment: 'centerPadded', // 'centerFull'|'centerPadded'|'left'|'right'|'alternate'|'none'
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
authorPrecededBy: 'Author:',
showCategories: 'no', // 'no'|'aboveText'|'belowText'
diff --git a/assets/js/src/newsletter_editor/blocks/base.js b/assets/js/src/newsletter_editor/blocks/base.js
index d9e40df82d..fa05c66020 100644
--- a/assets/js/src/newsletter_editor/blocks/base.js
+++ b/assets/js/src/newsletter_editor/blocks/base.js
@@ -26,7 +26,12 @@ define([
});
},
_getDefaults: function getDefaults(blockDefaults, configDefaults) {
- var defaults = (_.isObject(configDefaults) && _.isFunction(configDefaults.toJSON)) ? configDefaults.toJSON() : configDefaults;
+ var defaults;
+ if (_.isObject(configDefaults) && _.isFunction(configDefaults.toJSON)) {
+ defaults = configDefaults.toJSON();
+ } else {
+ defaults = configDefaults;
+ }
// Patch the resulting JSON object and fix it's constructors to be Object.
// Otherwise SuperModel interprets it not as a simpleObject
@@ -144,7 +149,10 @@ define([
}.bind(this));
},
duplicateBlock: function duplicateBlock() {
- this.model.collection.add(this.model.toJSON(), { at: this.model.collection.findIndex(this.model) });
+ this.model.collection.add(
+ this.model.toJSON(),
+ { at: this.model.collection.findIndex(this.model) }
+ );
},
transitionIn: function transitionIn() {
return this._transition('slideDown', 'fadeIn', 'easeOut');
diff --git a/assets/js/src/newsletter_editor/blocks/container.js b/assets/js/src/newsletter_editor/blocks/container.js
index e1569ddb53..24c09b8f50 100644
--- a/assets/js/src/newsletter_editor/blocks/container.js
+++ b/assets/js/src/newsletter_editor/blocks/container.js
@@ -175,7 +175,9 @@ define([
}));
// TODO: Look for a better way to do this than here
- // Sets child container orientation HTML class here, as child CollectionView won't have access to model and will overwrite existing region element instead
+ // Sets child container orientation HTML class here,
+ // as child CollectionView won't have access to model
+ // and will overwrite existing region element instead
this.$('> .mailpoet_container').attr('class', 'mailpoet_container mailpoet_container_' + this.model.get('orientation'));
},
showTools: function () {
diff --git a/assets/js/src/newsletter_editor/blocks/divider.js b/assets/js/src/newsletter_editor/blocks/divider.js
index a1e36c8d0d..00f5024610 100644
--- a/assets/js/src/newsletter_editor/blocks/divider.js
+++ b/assets/js/src/newsletter_editor/blocks/divider.js
@@ -8,12 +8,12 @@ define([
'newsletter_editor/blocks/base',
'underscore',
'jquery'
-], function (App, BaseBlock, _, jQuery) { // eslint-disable-line func-names
+], function dividerBlock(App, BaseBlock, _, jQuery) {
var Module = {};
var base = BaseBlock;
Module.DividerBlockModel = base.BlockModel.extend({
- defaults: function () { // eslint-disable-line func-names
+ defaults: function defaults() {
return this._getDefaults({
type: 'divider',
styles: {
@@ -31,13 +31,13 @@ define([
Module.DividerBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_divider_block mailpoet_droppable_block',
- getTemplate: function () { return window.templates.dividerBlock; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.dividerBlock; },
modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
behaviors: _.defaults({
ResizableBehavior: {
elementSelector: '.mailpoet_content',
resizeHandleSelector: '.mailpoet_resize_handle',
- transformationFunction: function (y) { return y / 2; }, // eslint-disable-line func-names
+ transformationFunction: function transformationFunction(y) { return y / 2; },
minLength: 0, // TODO: Move this number to editor configuration
modelField: 'styles.block.padding'
},
@@ -45,32 +45,34 @@ define([
ignoreFrom: '.mailpoet_resize_handle'
}
}, base.BlockView.prototype.behaviors),
- onDragSubstituteBy: function () { return Module.DividerWidgetView; }, // eslint-disable-line func-names
- initialize: function () { // eslint-disable-line func-names
+ onDragSubstituteBy: function onDragSubstituteBy() { return Module.DividerWidgetView; },
+ initialize: function initialize() {
var that = this;
base.BlockView.prototype.initialize.apply(this, arguments);
// Listen for attempts to change all dividers in one go
- this._replaceDividerHandler = function (data) { that.model.set(data); that.model.trigger('applyToAll'); }; // eslint-disable-line func-names
+ this._replaceDividerHandler = function replaceDividerHandler(data) {
+ that.model.set(data); that.model.trigger('applyToAll');
+ };
App.getChannel().on('replaceAllDividers', this._replaceDividerHandler);
this.listenTo(this.model, 'change:src change:styles.block.backgroundColor change:styles.block.borderStyle change:styles.block.borderWidth change:styles.block.borderColor applyToAll', this.render);
this.listenTo(this.model, 'change:styles.block.padding', this.changePadding);
},
- templateContext: function () { // eslint-disable-line func-names
+ templateContext: function templateContext() {
return _.extend({
totalHeight: parseInt(this.model.get('styles.block.padding'), 10) * 2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px'
}, base.BlockView.prototype.templateContext.apply(this));
},
- onRender: function () { // eslint-disable-line func-names
+ onRender: function onRender() {
this.toolsView = new Module.DividerBlockToolsView({ model: this.model });
this.showChildView('toolsRegion', this.toolsView);
},
- onBeforeDestroy: function () { // eslint-disable-line func-names
+ onBeforeDestroy: function onBeforeDestroy() {
App.getChannel().off('replaceAllDividers', this._replaceDividerHandler);
this.stopListening(this.model);
},
- changePadding: function () { // eslint-disable-line func-names
+ changePadding: function changePadding() {
this.$('.mailpoet_content').css('padding-top', this.model.get('styles.block.padding'));
this.$('.mailpoet_content').css('padding-bottom', this.model.get('styles.block.padding'));
this.$('.mailpoet_resize_handle_text').text(parseInt(this.model.get('styles.block.padding'), 10) * 2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px');
@@ -78,12 +80,12 @@ define([
});
Module.DividerBlockToolsView = base.BlockToolsView.extend({
- getSettingsView: function () { return Module.DividerBlockSettingsView; } // eslint-disable-line func-names
+ getSettingsView: function getSettingsView() { return Module.DividerBlockSettingsView; }
});
Module.DividerBlockSettingsView = base.BlockSettingsView.extend({
- getTemplate: function () { return window.templates.dividerBlockSettings; }, // eslint-disable-line func-names
- events: function () { // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.dividerBlockSettings; },
+ events: function events() {
return {
'click .mailpoet_field_divider_style': 'changeStyle',
@@ -97,47 +99,47 @@ define([
'click .mailpoet_done_editing': 'close'
};
},
- modelEvents: function () { // eslint-disable-line func-names
+ modelEvents: function modelEvents() {
return {
'change:styles.block.borderColor': 'repaintDividerStyleOptions'
};
},
- templateContext: function () { // eslint-disable-line func-names
+ templateContext: function templateContext() {
return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
availableStyles: App.getAvailableStyles().toJSON(),
renderOptions: this.renderOptions
});
},
- changeStyle: function (event) { // eslint-disable-line func-names
+ changeStyle: function changeStyle(event) {
var style = jQuery(event.currentTarget).data('style');
this.model.set('styles.block.borderStyle', style);
this.$('.mailpoet_field_divider_style').removeClass('mailpoet_active_divider_style');
this.$('.mailpoet_field_divider_style[data-style="' + style + '"]').addClass('mailpoet_active_divider_style');
},
- repaintDividerStyleOptions: function () { // eslint-disable-line func-names
+ repaintDividerStyleOptions: function repaintDividerStyleOptions() {
this.$('.mailpoet_field_divider_style > div').css('border-top-color', this.model.get('styles.block.borderColor'));
},
- applyToAll: function () { // eslint-disable-line func-names
+ applyToAll: function applyToAll() {
App.getChannel().trigger('replaceAllDividers', this.model.toJSON());
},
- updateValueAndCall: function (fieldToUpdate, callable, event) { // eslint-disable-line func-names
+ updateValueAndCall: function updateValueAndCall(fieldToUpdate, callable, event) {
this.$(fieldToUpdate).val(jQuery(event.target).val());
callable(event);
}
});
Module.DividerWidgetView = base.WidgetView.extend({
- getTemplate: function () { return window.templates.dividerInsertion; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.dividerInsertion; },
behaviors: {
DraggableBehavior: {
cloneOriginal: true,
- drop: function () { // eslint-disable-line func-names
+ drop: function drop() {
return new Module.DividerBlockModel();
}
}
}
});
- App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
+ App.on('before:start', function onBeforeStart(BeforeStartApp) {
BeforeStartApp.registerBlockType('divider', {
blockModel: Module.DividerBlockModel,
blockView: Module.DividerBlockView
diff --git a/assets/js/src/newsletter_editor/blocks/footer.js b/assets/js/src/newsletter_editor/blocks/footer.js
index 57ad67b4f4..be5f8378e1 100644
--- a/assets/js/src/newsletter_editor/blocks/footer.js
+++ b/assets/js/src/newsletter_editor/blocks/footer.js
@@ -8,12 +8,12 @@ define([
'newsletter_editor/blocks/base',
'underscore',
'mailpoet'
-], function (App, BaseBlock, _, MailPoet) { // eslint-disable-line func-names
+], function footerBlock(App, BaseBlock, _, MailPoet) {
var Module = {};
var base = BaseBlock;
Module.FooterBlockModel = base.BlockModel.extend({
- defaults: function () { // eslint-disable-line func-names
+ defaults: function defaults() {
return this._getDefaults({
type: 'footer',
text: 'Unsubscribe | Manage subscription
Add your postal address here!',
@@ -38,13 +38,13 @@ define([
Module.FooterBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_footer_block mailpoet_droppable_block',
- getTemplate: function () { return window.templates.footerBlock; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.footerBlock; },
modelEvents: _.extend({
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
}, _.omit(base.BlockView.prototype.modelEvents, 'change')),
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
TextEditorBehavior: {
- configurationFilter: function (originalSettings) { // eslint-disable-line func-names
+ configurationFilter: function configurationFilter(originalSettings) {
return _.extend({}, originalSettings, {
mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
@@ -52,37 +52,37 @@ define([
}
}
}),
- onDragSubstituteBy: function () { return Module.FooterWidgetView; }, // eslint-disable-line func-names
- onRender: function () { // eslint-disable-line func-names
+ onDragSubstituteBy: function onDragSubstituteBy() { return Module.FooterWidgetView; },
+ onRender: function onRender() {
this.toolsView = new Module.FooterBlockToolsView({ model: this.model });
this.showChildView('toolsRegion', this.toolsView);
},
- onTextEditorChange: function (newContent) { // eslint-disable-line func-names
+ onTextEditorChange: function onTextEditorChange(newContent) {
this.model.set('text', newContent);
},
- onTextEditorFocus: function () { // eslint-disable-line func-names
+ onTextEditorFocus: function onTextEditorFocus() {
this.disableDragging();
this.disableShowingTools();
},
- onTextEditorBlur: function () { // eslint-disable-line func-names
+ onTextEditorBlur: function onTextEditorBlur() {
this.enableDragging();
this.enableShowingTools();
}
});
Module.FooterBlockToolsView = base.BlockToolsView.extend({
- getSettingsView: function () { return Module.FooterBlockSettingsView; } // eslint-disable-line func-names
+ getSettingsView: function getSettingsView() { return Module.FooterBlockSettingsView; }
});
Module.FooterBlockSettingsView = base.BlockSettingsView.extend({
- getTemplate: function () { return window.templates.footerBlockSettings; }, // eslint-disable-line func-names
- events: function () { // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.footerBlockSettings; },
+ events: function events() {
return {
'change .mailpoet_field_footer_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
'change .mailpoet_field_footer_text_font_family': _.partial(this.changeField, 'styles.text.fontFamily'),
'change .mailpoet_field_footer_text_size': _.partial(this.changeField, 'styles.text.fontSize'),
'change #mailpoet_field_footer_link_color': _.partial(this.changeColorField, 'styles.link.fontColor'),
- 'change #mailpoet_field_footer_link_underline': function (event) { // eslint-disable-line func-names
+ 'change #mailpoet_field_footer_link_underline': function linkUnderline(event) {
this.model.set('styles.link.textDecoration', (event.target.checked) ? event.target.value : 'none');
},
'change .mailpoet_field_footer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
@@ -90,7 +90,7 @@ define([
'click .mailpoet_done_editing': 'close'
};
},
- templateContext: function () { // eslint-disable-line func-names
+ templateContext: function templateContext() {
return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
availableStyles: App.getAvailableStyles().toJSON()
});
@@ -98,18 +98,18 @@ define([
});
Module.FooterWidgetView = base.WidgetView.extend({
- getTemplate: function () { return window.templates.footerInsertion; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.footerInsertion; },
behaviors: {
DraggableBehavior: {
cloneOriginal: true,
- drop: function () { // eslint-disable-line func-names
+ drop: function drop() {
return new Module.FooterBlockModel();
}
}
}
});
- App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
+ App.on('before:start', function beforeAppStart(BeforeStartApp) {
BeforeStartApp.registerBlockType('footer', {
blockModel: Module.FooterBlockModel,
blockView: Module.FooterBlockView
diff --git a/assets/js/src/newsletter_editor/blocks/header.js b/assets/js/src/newsletter_editor/blocks/header.js
index fb0020c4fc..c523f0db88 100644
--- a/assets/js/src/newsletter_editor/blocks/header.js
+++ b/assets/js/src/newsletter_editor/blocks/header.js
@@ -8,12 +8,12 @@ define([
'newsletter_editor/blocks/base',
'underscore',
'mailpoet'
-], function (App, BaseBlock, _, MailPoet) { // eslint-disable-line func-names
+], function headerBlock(App, BaseBlock, _, MailPoet) {
var Module = {};
var base = BaseBlock;
Module.HeaderBlockModel = base.BlockModel.extend({
- defaults: function () { // eslint-disable-line func-names
+ defaults: function defaults() {
return this._getDefaults({
type: 'header',
text: 'Display problems? View it in your browser',
@@ -38,13 +38,13 @@ define([
Module.HeaderBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_header_block mailpoet_droppable_block',
- getTemplate: function () { return window.templates.headerBlock; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.headerBlock; },
modelEvents: _.extend({
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
}, _.omit(base.BlockView.prototype.modelEvents, 'change')),
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
TextEditorBehavior: {
- configurationFilter: function (originalSettings) { // eslint-disable-line func-names
+ configurationFilter: function configurationFilter(originalSettings) {
return _.extend({}, originalSettings, {
mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
@@ -52,37 +52,37 @@ define([
}
}
}),
- onDragSubstituteBy: function () { return Module.HeaderWidgetView; }, // eslint-disable-line func-names
- onRender: function () { // eslint-disable-line func-names
+ onDragSubstituteBy: function onDragSubstituteBy() { return Module.HeaderWidgetView; },
+ onRender: function onRender() {
this.toolsView = new Module.HeaderBlockToolsView({ model: this.model });
this.showChildView('toolsRegion', this.toolsView);
},
- onTextEditorChange: function (newContent) { // eslint-disable-line func-names
+ onTextEditorChange: function onTextEditorChange(newContent) {
this.model.set('text', newContent);
},
- onTextEditorFocus: function () { // eslint-disable-line func-names
+ onTextEditorFocus: function onTextEditorFocus() {
this.disableDragging();
this.disableShowingTools();
},
- onTextEditorBlur: function () { // eslint-disable-line func-names
+ onTextEditorBlur: function onTextEditorBlur() {
this.enableDragging();
this.enableShowingTools();
}
});
Module.HeaderBlockToolsView = base.BlockToolsView.extend({
- getSettingsView: function () { return Module.HeaderBlockSettingsView; } // eslint-disable-line func-names
+ getSettingsView: function getSettingsView() { return Module.HeaderBlockSettingsView; }
});
Module.HeaderBlockSettingsView = base.BlockSettingsView.extend({
- getTemplate: function () { return window.templates.headerBlockSettings; }, // eslint-disable-line func-names
- events: function () { // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.headerBlockSettings; },
+ events: function events() {
return {
'change .mailpoet_field_header_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
'change .mailpoet_field_header_text_font_family': _.partial(this.changeField, 'styles.text.fontFamily'),
'change .mailpoet_field_header_text_size': _.partial(this.changeField, 'styles.text.fontSize'),
'change #mailpoet_field_header_link_color': _.partial(this.changeColorField, 'styles.link.fontColor'),
- 'change #mailpoet_field_header_link_underline': function (event) { // eslint-disable-line func-names
+ 'change #mailpoet_field_header_link_underline': function linkUnderline(event) {
this.model.set('styles.link.textDecoration', (event.target.checked) ? event.target.value : 'none');
},
'change .mailpoet_field_header_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
@@ -90,7 +90,7 @@ define([
'click .mailpoet_done_editing': 'close'
};
},
- templateContext: function () { // eslint-disable-line func-names
+ templateContext: function templateContext() {
return _.extend({}, base.BlockView.prototype.templateContext.apply(this, arguments), {
availableStyles: App.getAvailableStyles().toJSON()
});
@@ -98,18 +98,18 @@ define([
});
Module.HeaderWidgetView = base.WidgetView.extend({
- getTemplate: function () { return window.templates.headerInsertion; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.headerInsertion; },
behaviors: {
DraggableBehavior: {
cloneOriginal: true,
- drop: function () { // eslint-disable-line func-names
+ drop: function drop() {
return new Module.HeaderBlockModel();
}
}
}
});
- App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
+ App.on('before:start', function beforeAppStart(BeforeStartApp) {
BeforeStartApp.registerBlockType('header', {
blockModel: Module.HeaderBlockModel,
blockView: Module.HeaderBlockView
diff --git a/assets/js/src/newsletter_editor/blocks/image.js b/assets/js/src/newsletter_editor/blocks/image.js
index a318057545..65c19d8cf5 100644
--- a/assets/js/src/newsletter_editor/blocks/image.js
+++ b/assets/js/src/newsletter_editor/blocks/image.js
@@ -357,7 +357,10 @@ define([
function (size) { return Math.abs(targetImageWidth - sizes[size].width); }
);
var bestWidth = sizes[_.first(increasingByWidthDifference)].width;
- var imagesOfBestWidth = _.filter(_.values(sizes), function (size) { return size.width === bestWidth; });
+ var imagesOfBestWidth = _.filter(
+ _.values(sizes),
+ function (size) { return size.width === bestWidth; }
+ );
// Maximize the height if there are multiple images with same width
var mainSize = _.max(imagesOfBestWidth, function (size) { return size.height; });
diff --git a/assets/js/src/newsletter_editor/blocks/posts.js b/assets/js/src/newsletter_editor/blocks/posts.js
index 6cf82656ba..73834fd171 100644
--- a/assets/js/src/newsletter_editor/blocks/posts.js
+++ b/assets/js/src/newsletter_editor/blocks/posts.js
@@ -65,7 +65,6 @@ define([
titleIsLink: false, // false|true
imageFullWidth: false, // true|false
featuredImagePosition: 'belowTitle', // 'aboveTitle'|'belowTitle'|'none'
- // imageAlignment: 'centerPadded', // 'centerFull'|'centerPadded'|'left'|'right'|'alternate'|'none'
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
authorPrecededBy: 'Author:',
showCategories: 'no', // 'no'|'aboveText'|'belowText'
@@ -95,8 +94,14 @@ define([
},
initialize: function () {
var POST_REFRESH_DELAY_MS = 500;
- var refreshAvailablePosts = _.debounce(this.fetchAvailablePosts.bind(this), POST_REFRESH_DELAY_MS);
- var refreshTransformedPosts = _.debounce(this._refreshTransformedPosts.bind(this), POST_REFRESH_DELAY_MS);
+ var refreshAvailablePosts = _.debounce(
+ this.fetchAvailablePosts.bind(this),
+ POST_REFRESH_DELAY_MS
+ );
+ var refreshTransformedPosts = _.debounce(
+ this._refreshTransformedPosts.bind(this),
+ POST_REFRESH_DELAY_MS
+ );
// Attach Radio.Requests API primarily for highlighting
_.extend(this, Radio.Requests);
diff --git a/assets/js/src/newsletter_editor/blocks/spacer.js b/assets/js/src/newsletter_editor/blocks/spacer.js
index 22220ba5eb..4a45d474b8 100644
--- a/assets/js/src/newsletter_editor/blocks/spacer.js
+++ b/assets/js/src/newsletter_editor/blocks/spacer.js
@@ -7,12 +7,12 @@ define([
'newsletter_editor/App',
'newsletter_editor/blocks/base',
'underscore'
-], function (App, BaseBlock, _) { // eslint-disable-line func-names
+], function spacerBlock(App, BaseBlock, _) {
var Module = {};
var base = BaseBlock;
Module.SpacerBlockModel = base.BlockModel.extend({
- defaults: function () { // eslint-disable-line func-names
+ defaults: function defaults() {
return this._getDefaults({
type: 'spacer',
styles: {
@@ -27,7 +27,7 @@ define([
Module.SpacerBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_spacer_block mailpoet_droppable_block',
- getTemplate: function () { return window.templates.spacerBlock; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.spacerBlock; },
behaviors: _.defaults({
ResizableBehavior: {
elementSelector: '.mailpoet_spacer',
@@ -40,33 +40,33 @@ define([
}
}, base.BlockView.prototype.behaviors),
modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
- onDragSubstituteBy: function () { return Module.SpacerWidgetView; }, // eslint-disable-line func-names
- initialize: function () { // eslint-disable-line func-names
+ onDragSubstituteBy: function onDragSubstituteBy() { return Module.SpacerWidgetView; },
+ initialize: function initialize() {
base.BlockView.prototype.initialize.apply(this, arguments);
this.listenTo(this.model, 'change:styles.block.backgroundColor', this.render);
this.listenTo(this.model, 'change:styles.block.height', this.changeHeight);
},
- onRender: function () { // eslint-disable-line func-names
+ onRender: function onRender() {
this.toolsView = new Module.SpacerBlockToolsView({ model: this.model });
this.showChildView('toolsRegion', this.toolsView);
},
- changeHeight: function () { // eslint-disable-line func-names
+ changeHeight: function changeHeight() {
this.$('.mailpoet_spacer').css('height', this.model.get('styles.block.height'));
this.$('.mailpoet_resize_handle_text').text(this.model.get('styles.block.height'));
},
- onBeforeDestroy: function () { // eslint-disable-line func-names
+ onBeforeDestroy: function onBeforeDestroy() {
this.stopListening(this.model);
}
});
Module.SpacerBlockToolsView = base.BlockToolsView.extend({
- getSettingsView: function () { return Module.SpacerBlockSettingsView; } // eslint-disable-line func-names
+ getSettingsView: function getSettingsView() { return Module.SpacerBlockSettingsView; }
});
Module.SpacerBlockSettingsView = base.BlockSettingsView.extend({
- getTemplate: function () { return window.templates.spacerBlockSettings; }, // eslint-disable-line func-names
- events: function () { // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.spacerBlockSettings; },
+ events: function events() {
return {
'change .mailpoet_field_spacer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
'click .mailpoet_done_editing': 'close'
@@ -75,18 +75,18 @@ define([
});
Module.SpacerWidgetView = base.WidgetView.extend({
- getTemplate: function () { return window.templates.spacerInsertion; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.spacerInsertion; },
behaviors: {
DraggableBehavior: {
cloneOriginal: true,
- drop: function () { // eslint-disable-line func-names
+ drop: function drop() {
return new Module.SpacerBlockModel();
}
}
}
});
- App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
+ App.on('before:start', function beforeAppStart(BeforeStartApp) {
BeforeStartApp.registerBlockType('spacer', {
blockModel: Module.SpacerBlockModel,
blockView: Module.SpacerBlockView
diff --git a/assets/js/src/newsletter_editor/blocks/text.js b/assets/js/src/newsletter_editor/blocks/text.js
index 27113e4cbd..b3e7197642 100644
--- a/assets/js/src/newsletter_editor/blocks/text.js
+++ b/assets/js/src/newsletter_editor/blocks/text.js
@@ -8,12 +8,12 @@ define([
'newsletter_editor/blocks/base',
'underscore',
'mailpoet'
-], function (App, BaseBlock, _, MailPoet) { // eslint-disable-line func-names
+], function textBlock(App, BaseBlock, _, MailPoet) {
var Module = {};
var base = BaseBlock;
Module.TextBlockModel = base.BlockModel.extend({
- defaults: function () { // eslint-disable-line func-names
+ defaults: function defaults() {
return this._getDefaults({
type: 'text',
text: 'Edit this to insert text'
@@ -23,7 +23,7 @@ define([
Module.TextBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_text_block mailpoet_droppable_block',
- getTemplate: function () { return window.templates.textBlock; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.textBlock; },
modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'), // Prevent rerendering on model change due to text editor redrawing
behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
TextEditorBehavior: {
@@ -33,7 +33,7 @@ define([
invalidElements: 'script',
blockFormats: 'Heading 1=h1;Heading 2=h2;Heading 3=h3;Paragraph=p',
plugins: 'link lists code textcolor colorpicker mailpoet_shortcodes paste',
- configurationFilter: function (originalSettings) { // eslint-disable-line func-names
+ configurationFilter: function configurationFilter(originalSettings) {
return _.extend({}, originalSettings, {
mailpoet_shortcodes: App.getConfig().get('shortcodes').toJSON(),
mailpoet_shortcodes_window_title: MailPoet.I18n.t('shortcodesWindowTitle')
@@ -41,7 +41,7 @@ define([
}
}
}),
- initialize: function (options) { // eslint-disable-line func-names
+ initialize: function initialize(options) {
base.BlockView.prototype.initialize.apply(this, arguments);
this.renderOptions = _.defaults(options.renderOptions || {}, {
@@ -50,8 +50,8 @@ define([
this.disableTextEditor = this.renderOptions.disableTextEditor;
},
- onDragSubstituteBy: function () { return Module.TextWidgetView; }, // eslint-disable-line func-names
- onRender: function () { // eslint-disable-line func-names
+ onDragSubstituteBy: function onDragSubstituteBy() { return Module.TextWidgetView; },
+ onRender: function onRender() {
this.toolsView = new Module.TextBlockToolsView({
model: this.model,
tools: {
@@ -60,40 +60,40 @@ define([
});
this.showChildView('toolsRegion', this.toolsView);
},
- onTextEditorChange: function (newContent) { // eslint-disable-line func-names
+ onTextEditorChange: function onTextEditorChange(newContent) {
this.model.set('text', newContent);
},
- onTextEditorFocus: function () { // eslint-disable-line func-names
+ onTextEditorFocus: function onTextEditorFocus() {
this.disableDragging();
this.disableShowingTools();
},
- onTextEditorBlur: function () { // eslint-disable-line func-names
+ onTextEditorBlur: function onTextEditorBlur() {
this.enableDragging();
this.enableShowingTools();
}
});
Module.TextBlockToolsView = base.BlockToolsView.extend({
- getSettingsView: function () { return Module.TextBlockSettingsView; } // eslint-disable-line func-names
+ getSettingsView: function getSettingsView() { return Module.TextBlockSettingsView; }
});
Module.TextBlockSettingsView = base.BlockSettingsView.extend({
- getTemplate: function () { return window.templates.textBlockSettings; } // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.textBlockSettings; }
});
Module.TextWidgetView = base.WidgetView.extend({
- getTemplate: function () { return window.templates.textInsertion; }, // eslint-disable-line func-names
+ getTemplate: function getTemplate() { return window.templates.textInsertion; },
behaviors: {
DraggableBehavior: {
cloneOriginal: true,
- drop: function () { // eslint-disable-line func-names
+ drop: function drop() {
return new Module.TextBlockModel();
}
}
}
});
- App.on('before:start', function (BeforeStartApp) { // eslint-disable-line func-names
+ App.on('before:start', function beforeAppStart(BeforeStartApp) {
BeforeStartApp.registerBlockType('text', {
blockModel: Module.TextBlockModel,
blockView: Module.TextBlockView
diff --git a/assets/js/src/notice.js b/assets/js/src/notice.js
index 71667a0809..6ec9f423f8 100644
--- a/assets/js/src/notice.js
+++ b/assets/js/src/notice.js
@@ -1,7 +1,7 @@
'use strict';
define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) { // eslint-disable-line func-names
- /*= =================================================================================================
+ /*= ==========================================================================================
MailPoet Notice:
@@ -22,7 +22,7 @@ define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) { // eslint-disab
// system message (static: true)
MailPoet.Notice.system('You need to updated ASAP!');
- ================================================================================================== */
+ =========================================================================================== */
var MailPoet = mp;
MailPoet.Notice = {
version: 1.0,
diff --git a/assets/js/src/subscribers/importExport/export.js b/assets/js/src/subscribers/importExport/export.js
index 3725bff925..4719f7f78f 100644
--- a/assets/js/src/subscribers/importExport/export.js
+++ b/assets/js/src/subscribers/importExport/export.js
@@ -5,7 +5,7 @@ define(
'mailpoet',
'handlebars'
],
- function (// eslint-disable-line func-names
+ function exportSubscribers(
_,
jQuery,
MailPoet,
@@ -14,7 +14,7 @@ define(
if (!jQuery('#mailpoet_subscribers_export').length) {
return;
}
- jQuery(document).ready(function () { // eslint-disable-line func-names
+ jQuery(document).ready(function documentReady() {
var segmentsContainerElement;
var subscriberFieldsContainerElement;
var nextStepButton;
@@ -43,7 +43,7 @@ define(
segmentsContainerElement = jQuery('#export_lists');
subscriberFieldsContainerElement = jQuery('#export_columns');
nextStepButton = jQuery('a.mailpoet_export_process');
- renderSegmentsAndFields = function (container, data) { // eslint-disable-line func-names
+ renderSegmentsAndFields = function renderSegmentsFields(container, data) {
if (container.data('select2')) {
container
.html('')
@@ -53,18 +53,18 @@ define(
.select2({
data: data,
width: '20em',
- templateResult: function (item) { // eslint-disable-line func-names
+ templateResult: function templateResult(item) {
return (item.subscriberCount > 0)
? item.name + ' (' + parseInt(item.subscriberCount).toLocaleString() + ')'
: item.name;
},
- templateSelection: function (item) { // eslint-disable-line func-names
+ templateSelection: function templateSelection(item) {
return (item.subscriberCount > 0)
? item.name + ' (' + parseInt(item.subscriberCount).toLocaleString() + ')'
: item.name;
}
})
- .on('select2:selecting', function (selectEvent) { // eslint-disable-line func-names
+ .on('select2:selecting', function onSelect2Selecting(selectEvent) {
var selectElement = this;
var selectedOptionId = selectEvent.params.args.data.id;
var fieldsToExclude = [
@@ -78,7 +78,7 @@ define(
jQuery(selectElement).val('').trigger('change');
} else {
allOptions = [];
- _.each(container.find('option'), function (field) { // eslint-disable-line func-names
+ _.each(container.find('option'), function eachOption(field) {
if (!_.contains(fieldsToExclude, field.value)) {
allOptions.push(field.value);
}
@@ -88,7 +88,7 @@ define(
jQuery(selectElement).select2('close');
}
})
- .on('change', function () { // eslint-disable-line func-names
+ .on('change', function onCHange() {
if ((window.exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
||
(!window.exportData.segments && subscriberFieldsContainerElement.select2('data').length)
@@ -111,7 +111,7 @@ define(
'list_status'
]).trigger('change');
- nextStepButton.click(function () { // eslint-disable-line func-names
+ nextStepButton.click(function nextClick() {
var exportFormat;
if (jQuery(this).hasClass('button-disabled')) {
return;
@@ -127,9 +127,9 @@ define(
segments: (window.exportData.segments) ? segmentsContainerElement.val() : false,
subscriber_fields: subscriberFieldsContainerElement.val()
})
- }).always(function () { // eslint-disable-line func-names
+ }).always(function always() {
MailPoet.Modal.loading(false);
- }).done(function (response) { // eslint-disable-line func-names
+ }).done(function done(response) {
var resultMessage = MailPoet.I18n.t('exportMessage')
.replace('%1$s', '' + parseInt(response.data.totalExported).toLocaleString() + '')
.replace('[link]', '')
@@ -141,10 +141,10 @@ define(
'File Format': exportFormat,
'MailPoet Free version': window.mailpoet_version
});
- }).fail(function (response) { // eslint-disable-line func-names
+ }).fail(function fail(response) {
if (response.errors.length > 0) {
MailPoet.Notice.error(
- response.errors.map(function (error) { return error.message; }), // eslint-disable-line func-names
+ response.errors.map(function mapError(error) { return error.message; }),
{ scroll: true }
);
}
diff --git a/assets/js/src/subscribers/importExport/import.js b/assets/js/src/subscribers/importExport/import.js
index 6671a2ec2f..8dca40d9e1 100644
--- a/assets/js/src/subscribers/importExport/import.js
+++ b/assets/js/src/subscribers/importExport/import.js
@@ -211,7 +211,8 @@ define(
if (emailColumnPosition === null
&& window.emailRegex.test(emailAddress)) {
emailColumnPosition = column;
- parsedEmails[emailAddress] = true; // add current e-mail to an object index
+ // add current e-mail to an object index
+ parsedEmails[emailAddress] = true;
rowData[column] = emailAddress;
processedSubscribers[emailAddress] = rowData;
}
@@ -763,7 +764,12 @@ define(
var columnId = jQuery(element).data('column-id');
var validationRule = jQuery(element).data('validation-rule');
jQuery(element).val(columnId).trigger('change');
- return { id: columnId, index: elementIndex, validationRule: validationRule, element: element };
+ return {
+ id: columnId,
+ index: elementIndex,
+ validationRule: validationRule,
+ element: element
+ };
});
// iterate through the object of mailpoet columns
jQuery.map(window.mailpoetColumns, function (column) {
@@ -774,7 +780,10 @@ define(
var allowedDateFormats;
// check if the column id matches the selected id of one of the
// subscriber's data columns
- var matchedColumn = _.find(displayedColumns, function (data) { return data.id === column.id; });
+ var matchedColumn = _.find(
+ displayedColumns,
+ function (data) { return data.id === column.id; }
+ );
// EMAIL filter: if the first value in the column doesn't have a valid
// email, hide the next button
if (column.id === 'email') {
@@ -974,7 +983,8 @@ define(
.each(function () {
var element = this;
var elementId = jQuery(element).val();
- // if another column has the same value and it's not an 'ignore', prompt user
+ // if another column has the same value and it's not an 'ignore',
+ // prompt user
if (elementId === selectedOptionId
&& elementId !== 'ignore') {
if (confirm(MailPoet.I18n.t('selectedValueAlreadyMatched') + ' ' + MailPoet.I18n.t('confirmCorrespondingColumn'))) {
@@ -1057,7 +1067,8 @@ define(
clickImportResults.created += response.data.created;
clickImportResults.updated += response.data.updated;
clickImportResults.segments = response.data.segments;
- clickImportResults.added_to_segment_with_welcome_notification = response.data.added_to_segment_with_welcome_notification;
+ clickImportResults.added_to_segment_with_welcome_notification =
+ response.data.added_to_segment_with_welcome_notification;
addQueue.run();
}).fail(function (response) {
MailPoet.Modal.loading(false);
@@ -1076,7 +1087,11 @@ define(
queue.onComplete(function () {
MailPoet.Modal.loading(false);
- if (clickImportResults.errors.length > 0 && !clickImportResults.updated && !clickImportResults.created) {
+ if (
+ clickImportResults.errors.length > 0
+ && !clickImportResults.updated
+ && !clickImportResults.created
+ ) {
MailPoet.Notice.error(_.flatten(clickImportResults.errors)
);
}
@@ -1134,7 +1149,8 @@ define(
.replace('%2$s', '"' + window.importData.step2.segments.join('", "') + '"')
: false,
no_action: (!window.importData.step2.created && !window.importData.step2.updated),
- added_to_segment_with_welcome_notification: window.importData.step2.added_to_segment_with_welcome_notification
+ added_to_segment_with_welcome_notification:
+ window.importData.step2.added_to_segment_with_welcome_notification
};
jQuery('#subscribers_data_import_results')