Sha256: 37cc56869d711514278fd300d3fe64ed1168d439d9bb64025c830f19d8ee594c

Contents?: true

Size: 932 Bytes

Versions: 9

Compression:

Stored size: 932 Bytes

Contents

pageflow.NestedFilesCollection = pageflow.SubsetCollection.extend({
  constructor: function(options) {
    var parent = options.parent;
    var parentFile = options.parentFile;

    var modelType = parentFile.fileType().typeName;
    var nestedFilesOrder = parent.fileType.nestedFilesOrder;

    pageflow.SubsetCollection.prototype.constructor.call(this, {
      parent: parent,
      parentModel: parentFile,

      filter: function(item) {
        return item.get('parent_file_id') === parentFile.get('id') &&
          item.get('parent_file_model_type') === modelType;
      },

      comparator: nestedFilesOrder && nestedFilesOrder.comparator
    });

    if (nestedFilesOrder) {
      this.listenTo(this,
                    'change:configuration:' + nestedFilesOrder.binding,
                    this.sort);
    }
  },

  getByPermaId: function(permaId) {
    return this.findWhere({perma_id: parseInt(permaId, 10)});
  }
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pageflow-15.0.2 app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js
pageflow-15.0.1 app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js
pageflow-15.0.0 app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js
pageflow-15.0.0.rc2 app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js
pageflow-15.0.0.rc1 app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js
pageflow-15.0.0.beta4 app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js
pageflow-15.0.0.beta3 app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js
pageflow-15.0.0.beta2 app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js
pageflow-15.0.0.beta1 app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js