Fix vendor asset loading, add initial newsletter data
This commit is contained in:
@ -4,6 +4,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
|
|
||||||
private $css_files = array(
|
private $css_files = array(
|
||||||
'assets/css/src/admin.styl',
|
'assets/css/src/admin.styl',
|
||||||
|
'assets/css/src/newsletter_editor/newsletter_editor.styl',
|
||||||
'assets/css/src/public.styl',
|
'assets/css/src/public.styl',
|
||||||
'assets/css/src/rtl.styl',
|
'assets/css/src/rtl.styl',
|
||||||
'assets/css/src/newsletter_editor/newsletter_editor.styl'
|
'assets/css/src/newsletter_editor/newsletter_editor.styl'
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
// Vendor CSS
|
||||||
|
@require 'select2/select2.css'
|
||||||
|
@require 'spectrum-colorpicker/spectrum.css'
|
||||||
|
|
||||||
// Bootstrapping
|
// Bootstrapping
|
||||||
@require 'mixins/border-radius'
|
@require 'mixins/border-radius'
|
||||||
@require 'mixins/box-shadow'
|
@require 'mixins/box-shadow'
|
||||||
|
@ -9,10 +9,9 @@
|
|||||||
define('newsletter_editor/blocks/automatedLatestContent', [
|
define('newsletter_editor/blocks/automatedLatestContent', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.automatedLatestContent", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.automatedLatestContent", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -7,18 +7,17 @@
|
|||||||
define('newsletter_editor/blocks/base', [
|
define('newsletter_editor/blocks/base', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
'modal',
|
'modal',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.base", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.base", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var AugmentedView = Marionette.LayoutView.extend({});
|
var AugmentedView = Marionette.LayoutView.extend({});
|
||||||
|
|
||||||
Module.BlockModel = SuperModel.extend({
|
Module.BlockModel = Backbone.SuperModel.extend({
|
||||||
stale: [], // Attributes to be removed upon saving
|
stale: [], // Attributes to be removed upon saving
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
@ -30,14 +29,14 @@ define('newsletter_editor/blocks/base', [
|
|||||||
var defaults = (_.isObject(configDefaults) && _.isFunction(configDefaults.toJSON)) ? configDefaults.toJSON() : configDefaults;
|
var defaults = (_.isObject(configDefaults) && _.isFunction(configDefaults.toJSON)) ? configDefaults.toJSON() : configDefaults;
|
||||||
|
|
||||||
// Patch the resulting JSON object and fix it's constructors to be Object.
|
// Patch the resulting JSON object and fix it's constructors to be Object.
|
||||||
// Otherwise SuperModel interprets it not as a simpleObject
|
// Otherwise Backbone.SuperModel interprets it not as a simpleObject
|
||||||
// and misbehaves
|
// and misbehaves
|
||||||
// TODO: Investigate for a better solution
|
// TODO: Investigate for a better solution
|
||||||
return JSON.parse(JSON.stringify(jQuery.extend(blockDefaults, defaults || {})));
|
return JSON.parse(JSON.stringify(jQuery.extend(blockDefaults, defaults || {})));
|
||||||
},
|
},
|
||||||
toJSON: function() {
|
toJSON: function() {
|
||||||
// Remove stale attributes from resulting JSON object
|
// Remove stale attributes from resulting JSON object
|
||||||
return _.omit(SuperModel.prototype.toJSON.call(this), this.stale);
|
return _.omit(Backbone.SuperModel.prototype.toJSON.call(this), this.stale);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
define('newsletter_editor/blocks/button', [
|
define('newsletter_editor/blocks/button', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.button", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.button", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -6,10 +6,9 @@
|
|||||||
define('newsletter_editor/blocks/container', [
|
define('newsletter_editor/blocks/container', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.container", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.container", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
define('newsletter_editor/blocks/divider', [
|
define('newsletter_editor/blocks/divider', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.divider", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.divider", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
define('newsletter_editor/blocks/footer', [
|
define('newsletter_editor/blocks/footer', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.footer", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.footer", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -54,37 +53,37 @@ define('newsletter_editor/blocks/footer', [
|
|||||||
},
|
},
|
||||||
attachTextEditor: function() {
|
attachTextEditor: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
this.$('.mailpoet_content').tinymce({
|
//this.$('.mailpoet_content').tinymce({
|
||||||
inline: true,
|
//inline: true,
|
||||||
|
|
||||||
menubar: false,
|
//menubar: false,
|
||||||
toolbar: "bold italic link unlink forecolor mailpoet_custom_fields",
|
//toolbar: "bold italic link unlink forecolor mailpoet_custom_fields",
|
||||||
|
|
||||||
valid_elements: "p[class|style],span[class|style],a[href|class|title|target|style],strong[class|style],em[class|style],strike,br",
|
//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",
|
//invalid_elements: "script",
|
||||||
style_formats: [
|
//style_formats: [
|
||||||
{title: 'Paragraph', block: 'p'},
|
//{title: 'Paragraph', block: 'p'},
|
||||||
],
|
//],
|
||||||
|
|
||||||
plugins: "wplink textcolor mailpoet_custom_fields",
|
//plugins: "wplink textcolor mailpoet_custom_fields",
|
||||||
|
|
||||||
setup: function(editor) {
|
//setup: function(editor) {
|
||||||
editor.on('change', function(e) {
|
//editor.on('change', function(e) {
|
||||||
that.model.set('text', editor.getContent());
|
//that.model.set('text', editor.getContent());
|
||||||
});
|
//});
|
||||||
|
|
||||||
editor.on('focus', function(e) {
|
//editor.on('focus', function(e) {
|
||||||
that.disableShowingTools();
|
//that.disableShowingTools();
|
||||||
});
|
//});
|
||||||
|
|
||||||
editor.on('blur', function(e) {
|
//editor.on('blur', function(e) {
|
||||||
that.enableShowingTools();
|
//that.enableShowingTools();
|
||||||
});
|
//});
|
||||||
},
|
//},
|
||||||
|
|
||||||
mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
//mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
||||||
mailpoet_custom_fields_window_title: App.getConfig().get('translations.customFieldsWindowTitle'),
|
//mailpoet_custom_fields_window_title: App.getConfig().get('translations.customFieldsWindowTitle'),
|
||||||
});
|
//});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
define('newsletter_editor/blocks/header', [
|
define('newsletter_editor/blocks/header', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.header", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.header", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -54,37 +53,37 @@ define('newsletter_editor/blocks/header', [
|
|||||||
},
|
},
|
||||||
attachTextEditor: function() {
|
attachTextEditor: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
this.$('.mailpoet_content').tinymce({
|
//this.$('.mailpoet_content').tinymce({
|
||||||
inline: true,
|
//inline: true,
|
||||||
|
|
||||||
menubar: false,
|
//menubar: false,
|
||||||
toolbar: "bold italic link unlink forecolor mailpoet_custom_fields",
|
//toolbar: "bold italic link unlink forecolor mailpoet_custom_fields",
|
||||||
|
|
||||||
valid_elements: "p[class|style],span[class|style],a[href|class|title|target|style],strong[class|style],em[class|style],strike,br",
|
//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",
|
//invalid_elements: "script",
|
||||||
style_formats: [
|
//style_formats: [
|
||||||
{title: 'Paragraph', block: 'p'},
|
//{title: 'Paragraph', block: 'p'},
|
||||||
],
|
//],
|
||||||
|
|
||||||
plugins: "wplink textcolor mailpoet_custom_fields",
|
//plugins: "wplink textcolor mailpoet_custom_fields",
|
||||||
|
|
||||||
setup: function(editor) {
|
//setup: function(editor) {
|
||||||
editor.on('change', function(e) {
|
//editor.on('change', function(e) {
|
||||||
that.model.set('text', editor.getContent());
|
//that.model.set('text', editor.getContent());
|
||||||
});
|
//});
|
||||||
|
|
||||||
editor.on('focus', function(e) {
|
//editor.on('focus', function(e) {
|
||||||
that.disableShowingTools();
|
//that.disableShowingTools();
|
||||||
});
|
//});
|
||||||
|
|
||||||
editor.on('blur', function(e) {
|
//editor.on('blur', function(e) {
|
||||||
that.enableShowingTools();
|
//that.enableShowingTools();
|
||||||
});
|
//});
|
||||||
},
|
//},
|
||||||
|
|
||||||
mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
//mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
||||||
mailpoet_custom_fields_window_title: App.getConfig().get('translations.customFieldsWindowTitle'),
|
//mailpoet_custom_fields_window_title: App.getConfig().get('translations.customFieldsWindowTitle'),
|
||||||
});
|
//});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
define('newsletter_editor/blocks/image', [
|
define('newsletter_editor/blocks/image', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.image", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.image", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -13,10 +13,9 @@
|
|||||||
define('newsletter_editor/blocks/posts', [
|
define('newsletter_editor/blocks/posts', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.posts", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.posts", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
define('newsletter_editor/blocks/social', [
|
define('newsletter_editor/blocks/social', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.social", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.social", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -15,7 +14,7 @@ define('newsletter_editor/blocks/social', [
|
|||||||
var base = App.module('blocks.base'),
|
var base = App.module('blocks.base'),
|
||||||
SocialBlockSettingsIconSelectorView, SocialBlockSettingsIconView, SocialBlockSettingsStylesView;
|
SocialBlockSettingsIconSelectorView, SocialBlockSettingsIconView, SocialBlockSettingsStylesView;
|
||||||
|
|
||||||
Module.SocialIconModel = SuperModel.extend({
|
Module.SocialIconModel = Backbone.SuperModel.extend({
|
||||||
defaults: function() {
|
defaults: function() {
|
||||||
var defaultValues = App.getConfig().get('socialIcons.custom');
|
var defaultValues = App.getConfig().get('socialIcons.custom');
|
||||||
return {
|
return {
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
define('newsletter_editor/blocks/spacer', [
|
define('newsletter_editor/blocks/spacer', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.spacer", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.spacer", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
define('newsletter_editor/blocks/text', [
|
define('newsletter_editor/blocks/text', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
'jquery',
|
'jquery',
|
||||||
//'tinymce',
|
//'tinymce',
|
||||||
//'jquery.tinymce',
|
//'jquery.tinymce',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet, jQuery, TinyMCE) {
|
], function(EditorApplication, Backbone, Marionette, MailPoet, jQuery, TinyMCE) {
|
||||||
|
|
||||||
EditorApplication.module("blocks.text", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("blocks.text", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -51,43 +50,43 @@ define('newsletter_editor/blocks/text', [
|
|||||||
attachTextEditor: function() {
|
attachTextEditor: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
if (!this.renderOptions.disableTextEditor) {
|
if (!this.renderOptions.disableTextEditor) {
|
||||||
this.$('.mailpoet_content').tinymce({
|
//this.$('.mailpoet_content').tinymce({
|
||||||
inline: true,
|
//inline: true,
|
||||||
|
|
||||||
menubar: false,
|
//menubar: false,
|
||||||
toolbar1: "styleselect bold italic forecolor | link unlink",
|
//toolbar1: "styleselect bold italic forecolor | link unlink",
|
||||||
toolbar2: "alignleft aligncenter alignright alignjustify | bullist numlist blockquote | code mailpoet_custom_fields",
|
//toolbar2: "alignleft aligncenter alignright alignjustify | bullist numlist blockquote | code mailpoet_custom_fields",
|
||||||
|
|
||||||
//forced_root_block: 'p',
|
////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]",
|
//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",
|
//invalid_elements: "script",
|
||||||
style_formats: [
|
//style_formats: [
|
||||||
{title: 'Heading 1', block: 'h1'},
|
//{title: 'Heading 1', block: 'h1'},
|
||||||
{title: 'Heading 2', block: 'h2'},
|
//{title: 'Heading 2', block: 'h2'},
|
||||||
{title: 'Heading 3', block: 'h3'},
|
//{title: 'Heading 3', block: 'h3'},
|
||||||
|
|
||||||
{title: 'Paragraph', block: 'p'},
|
//{title: 'Paragraph', block: 'p'},
|
||||||
],
|
//],
|
||||||
|
|
||||||
plugins: "wplink code textcolor mailpoet_custom_fields",
|
//plugins: "wplink code textcolor mailpoet_custom_fields",
|
||||||
|
|
||||||
setup: function(editor) {
|
//setup: function(editor) {
|
||||||
editor.on('change', function(e) {
|
//editor.on('change', function(e) {
|
||||||
that.model.set('text', editor.getContent());
|
//that.model.set('text', editor.getContent());
|
||||||
});
|
//});
|
||||||
|
|
||||||
editor.on('focus', function(e) {
|
//editor.on('focus', function(e) {
|
||||||
that.disableShowingTools();
|
//that.disableShowingTools();
|
||||||
});
|
//});
|
||||||
|
|
||||||
editor.on('blur', function(e) {
|
//editor.on('blur', function(e) {
|
||||||
that.enableShowingTools();
|
//that.enableShowingTools();
|
||||||
});
|
//});
|
||||||
},
|
//},
|
||||||
|
|
||||||
mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
//mailpoet_custom_fields: App.getConfig().get('customFields').toJSON(),
|
||||||
mailpoet_custom_fields_window_title: App.getConfig().get('translations.customFieldsWindowTitle'),
|
//mailpoet_custom_fields_window_title: App.getConfig().get('translations.customFieldsWindowTitle'),
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
define('newsletter_editor/components/config', [
|
define('newsletter_editor/components/config', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
], function(EditorApplication, Backbone) {
|
||||||
], function(EditorApplication, Backbone, SuperModel) {
|
|
||||||
|
|
||||||
EditorApplication.module("components.config", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("components.config", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Module.ConfigModel = SuperModel.extend({
|
Module.ConfigModel = Backbone.SuperModel.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
availableStyles: {},
|
availableStyles: {},
|
||||||
socialIcons: {},
|
socialIcons: {},
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
define('newsletter_editor/components/content', [
|
define('newsletter_editor/components/content', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette) {
|
], function(EditorApplication, Backbone, Marionette) {
|
||||||
|
|
||||||
EditorApplication.module("components.content", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("components.content", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -11,7 +10,7 @@ define('newsletter_editor/components/content', [
|
|||||||
// Holds newsletter entry fields, such as subject or creation datetime.
|
// Holds newsletter entry fields, such as subject or creation datetime.
|
||||||
// Does not hold newsletter content nor newsletter styles, those are
|
// Does not hold newsletter content nor newsletter styles, those are
|
||||||
// handled by other components.
|
// handled by other components.
|
||||||
Module.NewsletterModel = SuperModel.extend({
|
Module.NewsletterModel = Backbone.SuperModel.extend({
|
||||||
stale: ['data', 'styles'],
|
stale: ['data', 'styles'],
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
this.on('change', function() {
|
this.on('change', function() {
|
||||||
@ -20,7 +19,7 @@ define('newsletter_editor/components/content', [
|
|||||||
},
|
},
|
||||||
toJSON: function() {
|
toJSON: function() {
|
||||||
// Remove stale attributes from resulting JSON object
|
// Remove stale attributes from resulting JSON object
|
||||||
return _.omit(SuperModel.prototype.toJSON.call(this), this.stale);
|
return _.omit(Backbone.SuperModel.prototype.toJSON.call(this), this.stale);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ define('newsletter_editor/components/content', [
|
|||||||
App.toJSON = Module.toJSON;
|
App.toJSON = Module.toJSON;
|
||||||
App.getNewsletter = Module.getNewsletter;
|
App.getNewsletter = Module.getNewsletter;
|
||||||
|
|
||||||
Module.newsletter = new Module.NewsletterModel(options.newsletter);
|
Module.newsletter = new Module.NewsletterModel(_.omit(_.clone(options.newsletter), ['data', 'styles']));
|
||||||
});
|
});
|
||||||
|
|
||||||
App.on('start', function(options) {
|
App.on('start', function(options) {
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
define('newsletter_editor/components/sidebar', [
|
define('newsletter_editor/components/sidebar', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'sticky-kit',
|
'sticky-kit',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette) {
|
], function(EditorApplication, Backbone, Marionette) {
|
||||||
|
|
||||||
EditorApplication.module("components.sidebar", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("components.sidebar", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Widget handlers for use to create new content blocks via drag&drop
|
// Widget handlers for use to create new content blocks via drag&drop
|
||||||
Module._contentWidgets = new (Backbone.Collection.extend({
|
Module._contentWidgets = new (Backbone.Collection.extend({
|
||||||
model: SuperModel.extend({
|
model: Backbone.SuperModel.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: '',
|
name: '',
|
||||||
priority: 100,
|
priority: 100,
|
||||||
@ -25,7 +24,7 @@ define('newsletter_editor/components/sidebar', [
|
|||||||
|
|
||||||
// Layout widget handlers for use to create new layout blocks via drag&drop
|
// Layout widget handlers for use to create new layout blocks via drag&drop
|
||||||
Module._layoutWidgets = new (Backbone.Collection.extend({
|
Module._layoutWidgets = new (Backbone.Collection.extend({
|
||||||
model: SuperModel.extend({
|
model: Backbone.SuperModel.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: '',
|
name: '',
|
||||||
priority: 100,
|
priority: 100,
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
define('newsletter_editor/components/styles', [
|
define('newsletter_editor/components/styles', [
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.supermodel',
|
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
], function(EditorApplication, Backbone, SuperModel, Marionette) {
|
], function(EditorApplication, Backbone, Marionette) {
|
||||||
|
|
||||||
EditorApplication.module("components.styles", function(Module, App, Backbone, Marionette, $, _) {
|
EditorApplication.module("components.styles", function(Module, App, Backbone, Marionette, $, _) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Module.StylesModel = SuperModel.extend({
|
Module.StylesModel = Backbone.SuperModel.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
text: {
|
text: {
|
||||||
fontColor: '#000000',
|
fontColor: '#000000',
|
||||||
@ -53,7 +52,7 @@ define('newsletter_editor/components/styles', [
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Module._globalStyles = new SuperModel();
|
Module._globalStyles = new Backbone.SuperModel();
|
||||||
Module.getGlobalStyles = function() {
|
Module.getGlobalStyles = function() {
|
||||||
return Module._globalStyles;
|
return Module._globalStyles;
|
||||||
};
|
};
|
||||||
|
@ -35,6 +35,9 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^5.8.22",
|
"babel-core": "^5.8.22",
|
||||||
"babel-loader": "^5.3.2",
|
"babel-loader": "^5.3.2",
|
||||||
|
"export-loader": "latest",
|
||||||
|
"import-loader": "latest",
|
||||||
|
"expose-loader": "latest",
|
||||||
"chai": "2.2.0",
|
"chai": "2.2.0",
|
||||||
"chai-jq": "0.0.8",
|
"chai-jq": "0.0.8",
|
||||||
"grunt": "^0.4.5",
|
"grunt": "^0.4.5",
|
||||||
|
@ -24,8 +24,7 @@
|
|||||||
<!-- javascripts -->
|
<!-- javascripts -->
|
||||||
<%= javascript(
|
<%= javascript(
|
||||||
'vendor.js',
|
'vendor.js',
|
||||||
'mailpoet.js',
|
'mailpoet.js'
|
||||||
'admin.js'
|
|
||||||
)%>
|
)%>
|
||||||
|
|
||||||
<!-- handlebars templates -->
|
<!-- handlebars templates -->
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -18,9 +18,8 @@ baseConfig = {
|
|||||||
alias: {
|
alias: {
|
||||||
'handlebars': 'handlebars/dist/handlebars.js',
|
'handlebars': 'handlebars/dist/handlebars.js',
|
||||||
'backbone.marionette': 'backbone.marionette/lib/backbone.marionette',
|
'backbone.marionette': 'backbone.marionette/lib/backbone.marionette',
|
||||||
|
'backbone.supermodel$': 'backbone.supermodel/build/backbone.supermodel.js',
|
||||||
'sticky-kit': 'sticky-kit/jquery.sticky-kit',
|
'sticky-kit': 'sticky-kit/jquery.sticky-kit',
|
||||||
//'tinymce': 'tinymce/tinymce.jquery',
|
|
||||||
//'jquery.tinymce': 'tinymce/jquery.tinymce.min.js',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
@ -31,6 +30,22 @@ baseConfig = {
|
|||||||
{
|
{
|
||||||
test: /\.jsx$/,
|
test: /\.jsx$/,
|
||||||
loader: 'babel-loader'
|
loader: 'babel-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: require.resolve('backbone'),
|
||||||
|
loader: 'expose-loader?Backbone',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: require.resolve('underscore'),
|
||||||
|
loader: 'expose-loader?_',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: require.resolve('backbone.supermodel'),
|
||||||
|
loader: 'imports-loader?Backbone=backbone!exports-loader?Backbone.SuperModel',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
include: require.resolve('handlebars'),
|
||||||
|
loader: 'expose-loader?Handlebars',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -54,7 +69,7 @@ config.push(_.extend({}, baseConfig, {
|
|||||||
'underscore',
|
'underscore',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'backbone.supermodel/build/backbone.supermodel.amd',
|
'backbone.supermodel',
|
||||||
'interact.js',
|
'interact.js',
|
||||||
'backbone.radio',
|
'backbone.radio',
|
||||||
//'moment-with-locales',
|
//'moment-with-locales',
|
||||||
|
Reference in New Issue
Block a user