Sha256: 869a8e29d4a2348d1840d43f8bed4ca5828c90f88779a45fb737e1695bf79376

Contents?: true

Size: 747 Bytes

Versions: 6

Compression:

Stored size: 747 Bytes

Contents

// Mixin for FilesCollecions
// Concrete collections need to set attribute "name". i.e. "audio_files"
pageflow.filesCollection = {
  initialize: function(models, options) {
    options = options || {};
    this.entry = options.entry;
  },

  comparator: function(file) {
    return file.get('file_name');
  },

  url: function() {
    return '/editor/entries/' + this.getEntry().get('id') + '/' + this.name;
  },

  getEntry: function() {
    return this.entry || pageflow.entry;
  },

  fileType: function() {
    var plural = _.map(this.name.split('_'), upperCaseFirst).join('');

    return plural.substring(0, plural.length-1);

    function upperCaseFirst(string) {
      return string.charAt(0).toUpperCase() + string.slice(1);
    }
  }
};

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pageflow-0.1.0 app/assets/javascripts/pageflow/editor/collections/mixins/files_collection.js
pageflow-0.0.5 app/assets/javascripts/pageflow/editor/collections/mixins/files_collection.js
pageflow-0.0.4 app/assets/javascripts/pageflow/editor/collections/mixins/files_collection.js
pageflow-0.0.3 app/assets/javascripts/pageflow/editor/collections/mixins/files_collection.js
pageflow-0.0.2 app/assets/javascripts/pageflow/editor/collections/mixins/files_collection.js
pageflow-0.0.1 app/assets/javascripts/pageflow/editor/collections/mixins/files_collection.js