app/assets/javascripts/pageflow/editor/models/entry.js in pageflow-0.5.0 vs app/assets/javascripts/pageflow/editor/models/entry.js in pageflow-0.6.0

- old
+ new

@@ -1,16 +1,25 @@ pageflow.Entry = Backbone.Model.extend({ paramRoot: 'entry', urlRoot: '/entries', modelName: 'entry', i18nKey: 'pageflow/entry', + collectionName: 'entries', - mixins: [pageflow.filesCountWatcher, pageflow.polling, pageflow.failureTracking], + autoSaveWidgets: true, + mixins: [pageflow.filesCountWatcher, + pageflow.polling, + pageflow.failureTracking, + pageflow.widgetSubject], + initialize: function(attributes, options) { options = options || {}; + this.configuration = new pageflow.EntryConfiguration(this.get('configuration') || {}); + this.configuration.parent = this; + this.files = options.files || pageflow.files; this.chapters = options.chapters || pageflow.chapters; this.chapters.parentModel = this; this.pages = pageflow.pages; @@ -24,11 +33,12 @@ this.listenTo(this.chapters, 'sort', function() { this.pages.sort(); }); - this.listenTo(this, 'change:title change:summary change:credits change:manual_start change:home_url change:home_button_enabled', function() { + this.listenTo(this.configuration, 'change', function() { + this.trigger('change:configuration'); this.save(); }); }, addChapter: function() { @@ -85,8 +95,8 @@ return response; }, toJSON: function() { - return _.pick(this.attributes, 'title', 'summary', 'credits', 'manual_start', 'home_url', 'home_button_enabled'); + return this.configuration.toJSON(); } });