Sha256: 0d9c81ec3c372ebdff60c3a64e4d9ddf8936448dd64fc3d9c1ab64a5df90b410
Contents?: true
Size: 1.24 KB
Versions: 46
Compression:
Stored size: 1.24 KB
Contents
/** * Base thumbnail view for models supporting a `thumbnailFile` method. * * @class * @memberof module:pageflow/editor */ pageflow.ModelThumbnailView = Backbone.Marionette.View.extend({ className: 'model_thumbnail', modelEvents: { 'change:configuration': 'update' }, render: function() { this.update(); return this; }, update: function() { if (this.model) { if (_.isFunction(this.model.thumbnailFile)) { var file = this.model && this.model.thumbnailFile(); if (this.thumbnailView && this.currentFileThumbnail == file) { return; } this.currentFileThumbnail = file; this.newThumbnailView = new pageflow.FileThumbnailView({ model: file, className: 'thumbnail file_thumbnail', imageUrlPropertyName: this.options.imageUrlPropertyName }); } else { this.newThumbnailView = this.newThumbnailView || new pageflow.StaticThumbnailView({ model: this.model }); } } if (this.thumbnailView) { this.thumbnailView.close(); } if (this.model) { this.thumbnailView = this.subview(this.newThumbnailView); this.$el.append(this.thumbnailView.el); } } });
Version data entries
46 entries across 46 versions & 1 rubygems