Sha256: a522bca1b088cae74048f1b56a3dc46afac6e2d97b7e7a02f79c814075b1ca02

Contents?: true

Size: 937 Bytes

Versions: 64

Compression:

Stored size: 937 Bytes

Contents

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

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

    pageflow.SubsetCollection.prototype.constructor.call(this, {
      parent: options.pages,
      parentModel: chapter,

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

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

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

    this.listenTo(this, 'add', function(model) {
      model.chapter = chapter;
      model.set('chapter_id', chapter.id);

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

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

    this.listenTo(chapter, 'destroy', function() {
      this.clear();
    });
  }
});

Version data entries

64 entries across 64 versions & 1 rubygems

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