Rename data attribute to body

This commit is contained in:
Tautvidas Sipavičius
2015-09-25 12:42:46 +03:00
parent d7029f3d29
commit 89a9c040a8
4 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@ define([
// 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 = SuperModel.extend({
stale: ['data'], stale: ['body'],
initialize: function(options) { initialize: function(options) {
this.on('change', function() { this.on('change', function() {
App.getChannel().trigger('autoSave'); App.getChannel().trigger('autoSave');
@ -45,7 +45,7 @@ define([
Module.toJSON = function() { Module.toJSON = function() {
return _.extend({ return _.extend({
data: { body: {
content: App._contentContainer.toJSON(), content: App._contentContainer.toJSON(),
globalStyles: App.getGlobalStyles().toJSON(), globalStyles: App.getGlobalStyles().toJSON(),
}, },
@ -64,12 +64,12 @@ define([
App.toJSON = Module.toJSON; App.toJSON = Module.toJSON;
App.getNewsletter = Module.getNewsletter; App.getNewsletter = Module.getNewsletter;
Module.newsletter = new Module.NewsletterModel(_.omit(_.clone(options.newsletter), ['data'])); Module.newsletter = new Module.NewsletterModel(_.omit(_.clone(options.newsletter), ['body']));
}); });
App.on('start', function(options) { App.on('start', function(options) {
// TODO: Other newsletter information will be needed as well. // TODO: Other newsletter information will be needed as well.
App._contentContainer = new (this.getBlockTypeModel('container'))(options.newsletter.data.content, {parse: true}); App._contentContainer = new (this.getBlockTypeModel('container'))(options.newsletter.body.content, {parse: true});
App._contentContainerView = new (this.getBlockTypeView('container'))({ App._contentContainerView = new (this.getBlockTypeView('container'))({
model: App._contentContainer, model: App._contentContainer,
renderOptions: { depth: 0 }, renderOptions: { depth: 0 },

View File

@ -72,7 +72,7 @@ define([
App.getAvailableStyles = Module.getAvailableStyles; App.getAvailableStyles = Module.getAvailableStyles;
this.setGlobalStyles(options.newsletter.data.globalStyles); this.setGlobalStyles(options.newsletter.body.globalStyles);
}); });
App.on('start', function(options) { App.on('start', function(options) {

View File

@ -9,7 +9,7 @@ define([
beforeEach(function() { beforeEach(function() {
model = new (ContentComponent.NewsletterModel)({ model = new (ContentComponent.NewsletterModel)({
data: { body: {
globalStyles: { globalStyles: {
style1: 'style1Value', style1: 'style1Value',
style2: 'style2Value', style2: 'style2Value',
@ -81,7 +81,7 @@ define([
}; };
var json = ContentComponent.toJSON(); var json = ContentComponent.toJSON();
expect(json).to.deep.equal(_.extend({ expect(json).to.deep.equal(_.extend({
data: { body: {
content: dataField, content: dataField,
globalStyles: stylesField globalStyles: stylesField
}, },

View File

@ -245,7 +245,7 @@
<script type="text/javascript"> <script type="text/javascript">
var newsletter = { var newsletter = {
"data": { "body": {
"content": { "content": {
"type": "container", "type": "container",
"orientation": "vertical", "orientation": "vertical",