{I" class:ETI"ProcessedAsset;FI"logical_path;TI"$type_station/editables/image.js;FI" pathname;TI"j/Users/richardadams/github/type_station/app/assets/javascripts/type_station/editables/image.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+ÅÃÐTI" length;TiÉ I" digest;TI"%53b33f17e43ce2ec026869b51a99aa06;FI" source;TI"É (function() { var buildUploader, setUpDrops; buildUploader = function(element, data) { var $input, elementId; elementId = $(element).attr('id'); $input = $(''); $input.attr({ type: "file", name: "file", "class": 'ts-editable-image-input', 'data-form-data': JSON.stringify(data), 'data-element-id': elementId }).cloudinary_fileupload().bind('cloudinaryprogress', function(e, data) { return $('.ts-progress-bar').css('width', Math.round((data.loaded * 100.0) / data.total) + '%'); }).bind('cloudinarystart', function(e, data) { $(this).prop('disabled', true); return $('body').append($('
').addClass('ts-progress-bar')); }).bind('cloudinarydone', function(e, data) { var $element, imageTag, model, _i, _len, _ref; $element = $("#" + ($(this).data('elementId'))); _ref = $('.ts-editable-image-tag', $element); for (_i = 0, _len = _ref.length; _i < _len; _i++) { imageTag = _ref[_i]; $(imageTag).attr('src', $.cloudinary.url(data.result.public_id, $(imageTag).data())); } $element.data('drop').close(); $(this).prop('disabled', false); $('.ts-progress-bar').remove(); model = window.TS.getModel($element.data('ts-url')); return model.set($element.data('ts-key'), { field: $element.data('ts-key'), value: { identifier: data.result.public_id }, type: 'image' }); }); return $input; }; setUpDrops = function(elements) { var drop, drops, element, tsData, _i, _len; drops = []; for (_i = 0, _len = elements.length; _i < _len; _i++) { element = elements[_i]; tsData = $(element).data('tsData'); drop = new Drop({ target: $('.ts-editable-button', element)[0], content: buildUploader(element, tsData)[0], position: 'bottom center', openOn: 'click', classes: 'drop-theme-arrows-bounce-dark' }); $(element).data('drop', drop); drops.push(drop); } return drops; }; window.TS.EditableImage = (function() { function EditableImage(_at_elements) { var element, _i, _len, _ref; this.elements = _at_elements; this.drops = []; _ref = this.elements; for (_i = 0, _len = _ref.length; _i < _len; _i++) { element = _ref[_i]; $(element).append($('
').addClass('ts-editable-button').addClass('ts-button').html("")); } } EditableImage.prototype.enable = function() { this.disable(); return this.drops = setUpDrops(this.elements); }; EditableImage.prototype.disable = function() { var drop, _i, _len, _ref; _ref = this.drops; for (_i = 0, _len = _ref.length; _i < _len; _i++) { drop = _ref[_i]; drop.close(); drop.remove(); drop.destroy(); } return this.drops = []; }; return EditableImage; })(); }).call(this); ;TI"dependency_digest;TI"%beabd41630efb19b9e2e13384b85219a;FI"required_paths;T[I"j/Users/richardadams/github/type_station/app/assets/javascripts/type_station/editables/image.js.coffee;FI"dependency_paths;T[{I" path;TI"j/Users/richardadams/github/type_station/app/assets/javascripts/type_station/editables/image.js.coffee;FI" mtime;TI"2015-02-03T12:49:09+00:00;TI" digest;TI"%cd5738e6b2ae4f016954b2b0b41d306f;FI" _version;TI"%4bf7b15359fe8e0974f7f263e26e27f4;F