o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1416672646.186121: @value"]{I" class:ETI"ProcessedAsset;FI"logical_path;TI"0locomotive/views/shared/fields/file_view.js;FI" pathname;TI"›/Users/didier/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/locomotive_cms-2.5.5/app/assets/javascripts/locomotive/views/shared/fields/file_view.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;TI"2014-11-22T16:47:36+01:00;TI" length;Ti1I" digest;TI"%6d741a9e4d109366c465d1e8564ecf8e;FI" source;TI"1(function() { var _base, _base1, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; (_base = Locomotive.Views).Shared || (_base.Shared = {}); (_base1 = Locomotive.Views.Shared).Fields || (_base1.Fields = {}); Locomotive.Views.Shared.Fields.FileView = (function(_super) { __extends(FileView, _super); function FileView() { return FileView.__super__.constructor.apply(this, arguments); } FileView.prototype.tagName = 'span'; FileView.prototype.className = 'file'; FileView.prototype.states = { change: false, "delete": false }; FileView.prototype.events = { 'click a.change': 'toggle_change', 'click a.delete': 'toggle_delete' }; FileView.prototype.template = function() { var prefix; prefix = this.options.namespace != null ? "" + this.options.namespace + "_" : ''; return ich["" + prefix + this.options.name + "_file_input"]; }; FileView.prototype.render = function() { var data, url; url = this.model.get("" + this.options.name + "_url") || ''; data = { filename: url.split('/').pop(), url: url }; $(this.el).html(this.template()(data)); this.$('input[type=file]').bind('change', (function(_this) { return function(event) { var hash, input, name; input = $(event.target)[0]; if (input.files != null) { name = $(input).prop('name'); hash = {}; hash[name.replace("" + _this.model.paramRoot + "[", '').replace(/]$/, '')] = input.files[0]; return _this.model.set(hash); } }; })(this)); return this; }; FileView.prototype.refresh = function() { this.$('input[type=file]').unbind('change'); this.states = { 'change': false, 'delete': false }; return this.render(); }; FileView.prototype.reset = function() { this.model.set_attribute(this.options.name, null); this.model.set_attribute("" + this.options.name + "_url", null); return this.refresh(); }; FileView.prototype.toggle_change = function(event) { return this._toggle(event, 'change', { on_change: (function(_this) { return function() { return _this.$('a:first').hide() & _this.$('input[type=file]').show() & _this.$('a.delete').hide(); }; })(this), on_cancel: (function(_this) { return function() { return _this.$('a:first').show() & _this.$('input[type=file]').hide() & _this.$('a.delete').show(); }; })(this) }); }; FileView.prototype.toggle_delete = function(event) { return this._toggle(event, 'delete', { on_change: (function(_this) { return function() { _this.$('a:first').addClass('deleted') & _this.$('a.change').hide(); _this.$('input[type=hidden].remove-flag').val('1'); return _this.model.set_attribute("remove_" + _this.options.name, true); }; })(this), on_cancel: (function(_this) { return function() { _this.$('a:first').removeClass('deleted') & _this.$('a.change').show(); _this.$('input[type=hidden].remove-flag').val('0'); return _this.model.set_attribute("remove_" + _this.options.name, false); }; })(this) }); }; FileView.prototype._toggle = function(event, state, options) { var button, label; event.stopPropagation() & event.preventDefault(); button = $(event.target); label = button.data('alt-label'); if (!this.states[state]) { options.on_change(); } else { options.on_cancel(); } button.data('alt-label', button.html()); button.html(label); return this.states[state] = !this.states[state]; }; FileView.prototype.remove = function() { this.$('input[type=file]').unbind('change'); return FileView.__super__.remove.apply(this, arguments); }; return FileView; })(Backbone.View); }).call(this); ;TI"dependency_digest;TI"%3eabc99bbe149ebb81c2b46b0cf53774;FI"required_paths;T[I"›/Users/didier/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/locomotive_cms-2.5.5/app/assets/javascripts/locomotive/views/shared/fields/file_view.js.coffee;FI"dependency_paths;T[{I" path;TI"›/Users/didier/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/locomotive_cms-2.5.5/app/assets/javascripts/locomotive/views/shared/fields/file_view.js.coffee;FI" mtime;TI"2014-11-22T16:47:36+01:00;TI" digest;TI"%0c411261dd6c74d966ee884d29fe9238;FI" _version;TI"%ffd318ca8b794f42f5029101c2cf5d91;F