Sha256: cc9bbf3cfc7d46565f43c38c44198f716083fa7c79a2c543f8582a60b350351f

Contents?: true

Size: 823 Bytes

Versions: 12

Compression:

Stored size: 823 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 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;
    });

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pageflow-0.9.2 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.9.1 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.9.0 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.8.2 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.8.1 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.8.0 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.7.2 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.7.1 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.7.0 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.6.0 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.5.0 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js
pageflow-0.4.0 app/assets/javascripts/pageflow/editor/collections/chapter_pages_collection.js