Sha256: f6e6ee677edb52776ba79ffad6b64a106948e1ddec941ad568988c98c86af5d6

Contents?: true

Size: 735 Bytes

Versions: 46

Compression:

Stored size: 735 Bytes

Contents

pageflow.WidgetsCollection = Backbone.Collection.extend({
  model: pageflow.Widget,

  initialize: function() {
    this.listenTo(this, 'change:type_name change:configuration', function() {
      this.batchSave();
    });
  },

  url: function() {
    return '/editor/subjects/entries/' + this.subject.id + '/widgets';
  },

  batchSave: function(options) {
    var subject = this.subject;

    return Backbone.sync('patch', subject, _.extend(options || {}, {
      url: this.url() + '/batch',

      attrs: {
        widgets: this.map(function(widget) {
          return widget.toJSON();
        })
      },

      success: function(response) {
        subject.trigger('sync:widgets', subject, response, {});
      }
    }));
  }
});

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
pageflow-14.0.0.rc1 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-14.0.0.beta3 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-14.0.0.beta2 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-14.0.0.beta1 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.6.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.5.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.4.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.3.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.2.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-12.6.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.1.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-12.5.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-12.4.1 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.0.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.0.0.rc1 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-12.4.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-12.3.0 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.0.0.beta7 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.0.0.beta6 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js
pageflow-13.0.0.beta5 app/assets/javascripts/pageflow/editor/collections/widgets_collection.js