Fix container to track child changes for initial newsletter
This commit is contained in:
@@ -18,6 +18,21 @@ define([
|
||||
base = BaseBlock,
|
||||
BlockCollection;
|
||||
|
||||
BlockCollection = Backbone.Collection.extend({
|
||||
model: base.BlockModel,
|
||||
initialize: function() {
|
||||
this.on('add change remove', function() { App.getChannel().trigger('autoSave'); });
|
||||
},
|
||||
parse: function(response) {
|
||||
var self = this;
|
||||
return _.map(response, function(block) {
|
||||
var Type = App.getBlockTypeModel(block.type);
|
||||
// TODO: If type has no registered model, use a backup one
|
||||
return new Type(block, {parse: true});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Module.ContainerBlockModel = base.BlockModel.extend({
|
||||
relations: {
|
||||
blocks: BlockCollection,
|
||||
@@ -52,21 +67,6 @@ define([
|
||||
},
|
||||
});
|
||||
|
||||
BlockCollection = Backbone.Collection.extend({
|
||||
model: base.BlockModel,
|
||||
initialize: function() {
|
||||
this.on('add change remove', function() { App.getChannel().trigger('autoSave'); });
|
||||
},
|
||||
parse: function(response) {
|
||||
var self = this;
|
||||
return _.map(response, function(block) {
|
||||
var Type = App.getBlockTypeModel(block.type);
|
||||
// TODO: If type has no registered model, use a backup one
|
||||
return new Type(block, {parse: true});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Module.ContainerBlockView = Marionette.CompositeView.extend({
|
||||
regionClass: Marionette.Region,
|
||||
className: 'mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block',
|
||||
|
Reference in New Issue
Block a user