Sha256: ee00a57e0ce9ec1d8a85c6fe232f974a7b812b2022d1b4aee183fcee84e53072
Contents?: true
Size: 1.09 KB
Versions: 34
Compression:
Stored size: 1.09 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, { styleGroup: this.$el.data('styleGroup') }); return url ? 'url("' + url + '")' : 'none'; } });
Version data entries
34 entries across 34 versions & 1 rubygems