Sha256: 6507fc64aafb471a0f2c4ebfb968ef9521f84890675e5d858e4b5304e6f6b0ee
Contents?: true
Size: 974 Bytes
Versions: 11
Compression:
Stored size: 974 Bytes
Contents
pageflow.BackgroundImageEmbeddedView = Backbone.Marionette.View.extend({ modelEvents: { 'change': 'update' }, render: function() { this.update(); return this; }, update: function() { this.$el.css({ backgroundImage: 'url("' + this.model.getImageFileUrl(this.options.propertyName) + '")', backgroundPosition: this.model.getImageFilePosition(this.options.propertyName, 'x') + '% ' + this.model.getImageFilePosition(this.options.propertyName, 'y') + '%', }); if (this.options.dataSizeAttributes) { var imageFile = this.model.getImageFile(this.options.propertyName); if (imageFile && imageFile.isReady()) { this.$el.attr('data-width', imageFile.get('width')); this.$el.attr('data-height', imageFile.get('height')); } else { this.$el.attr('data-width', '16'); this.$el.attr('data-height', '9'); } this.$el.css({backgroundPosition:'0 0'}); } } });
Version data entries
11 entries across 11 versions & 1 rubygems