Sha256: c9570efe9b6e4413fc2f83f373ef4df3b342e946742e10c18ecdfe9b2fbcb8af
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
pageflow.BackgroundImageEmbeddedView = Backbone.Marionette.View.extend({ modelEvents: { 'change': 'update' }, render: function() { this.update(); return this; }, update: function() { this.$el.css({ backgroundImage: this.imageValue(), backgroundPosition: this.model.getFilePosition(this.options.propertyName, 'x') + '% ' + this.model.getFilePosition(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'}); } }, imageValue: function() { var url = this.model.getImageFileUrl(this.options.propertyName); return url ? 'url("' + url + '")' : 'none'; } });
Version data entries
7 entries across 7 versions & 1 rubygems