Sha256: d8f266f755113b3ab2370f17ec66a5b5f97187653d182524e26632e1600f4a07

Contents?: true

Size: 900 Bytes

Versions: 64

Compression:

Stored size: 900 Bytes

Contents

pageflow.StorylineChaptersCollection = pageflow.SubsetCollection.extend({
  mixins: [pageflow.orderedCollection],

  constructor: function(options) {
    var storyline = options.storyline;

    pageflow.SubsetCollection.prototype.constructor.call(this, {
      parent: options.chapters,
      parentModel: storyline,

      filter: function(item) {
        return !storyline.isNew() && item.get('storyline_id') === storyline.id;
      },

      comparator: function(item) {
        return item.get('position');
      }
    });

    this.each(function(chapter) {
      chapter.storyline = storyline;
    });

    this.listenTo(this, 'add', function(model) {
      model.storyline = storyline;
      model.set('storyline_id', storyline.id);

      pageflow.editor.trigger('add:chapter', model);
    });

    this.listenTo(this, 'remove', function(model) {
      model.storyline = null;
    });
  }
});

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
pageflow-14.5.2 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-15.0.2 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-15.0.1 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-15.0.0 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.5.1 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.5.0 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-15.0.0.rc2 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-15.0.0.rc1 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-15.0.0.beta4 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-15.0.0.beta3 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.4.0 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-15.0.0.beta2 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-15.0.0.beta1 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.3.0 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.2.1 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.2.0 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.1.1 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.1.0 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.0.0 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js
pageflow-14.0.0.rc2 app/assets/javascripts/pageflow/editor/collections/storyline_chapters_collection.js