Sha256: 4aee85bd074bab2624e2e858f427c0da00a99fd7c76618e1ab9057901a06c95e
Contents?: true
Size: 1.04 KB
Versions: 74
Compression:
Stored size: 1.04 KB
Contents
pageflow.BackgroundPositioningPreviewView = Backbone.Marionette.ItemView.extend({ template: 'templates/background_positioning_preview', className: 'preview', modelEvents: { change: 'update' }, ui: { image: '.image', label: '.label' }, onRender: function() { this.update(); }, update: function() { var ratio = this.options.ratio; var max = this.options.maxSize; var width = ratio > 1 ? max : max * ratio; var height = ratio > 1 ? max / ratio : max; this.ui.image.css({ width: width + 'px', height: height + 'px', backgroundImage: this.imageValue(), backgroundPosition: this.model.getFilePosition(this.options.propertyName, 'x') + '% ' + this.model.getFilePosition(this.options.propertyName, 'y') + '%' }); this.ui.label.text(this.options.label); }, imageValue: function() { var file = this.model.getReference(this.options.propertyName, this.options.filesCollection); return file ? 'url("' + file.getBackgroundPositioningImageUrl() + '")' : 'none'; } });
Version data entries
74 entries across 74 versions & 1 rubygems