Sha256: a08c1edd3844458bb401bee743730723962b3c6667304c9bc08950e30e5cc735

Contents?: true

Size: 802 Bytes

Versions: 9

Compression:

Stored size: 802 Bytes

Contents

// Represents assets in a few different states. Simple assets as they exist
// in the Asset Library; Assets in use within a Slice; and Assets in the
// process of being uploaded.
slices.Asset = Backbone.Model.extend({

  urlRoot: '/admin/assets',

  // Filtered set of attrs
  toJSON: function() {
    return { asset: {
      name: this.get('name'),
      tags: this.get('tags')
    }};
  },

  isImage: function() {
    return (this.get('file_content_type') || '').indexOf('image') === 0;
  },

  // Okay, so this method involves a bit of reaching into the prototype
  // cookie jar, as Backbone doesn’t really have a way to subclass these
  // fundamental methods of models.
  destroy: function(options) {
    this.trigger('destroying');
    Backbone.Model.prototype.destroy.apply(this);
  }

});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
slices-2.0.2 app/assets/javascripts/slices/app/models/asset.js
slices-2.0.1 app/assets/javascripts/slices/app/models/asset.js
slices-2.0.0 app/assets/javascripts/slices/app/models/asset.js
slices-1.0.5 app/assets/javascripts/slices/app/models/asset.js
slices-1.0.4 app/assets/javascripts/slices/app/models/asset.js
slices-1.0.3 app/assets/javascripts/slices/app/models/asset.js
slices-1.0.2 app/assets/javascripts/slices/app/models/asset.js
slices-1.0.1 app/assets/javascripts/slices/app/models/asset.js
slices-1.0.0 app/assets/javascripts/slices/app/models/asset.js