o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1372441622.656936:@value"q{I"
class:EFI"ProcessedAsset; FI"logical_path; F"#iugu-ux/editors/file_editor.jsI"
pathname; F"p/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/editors/file_editor.js.coffeeI"content_type; FI"application/javascript; FI"
mtime; FI"2013-01-17T19:14:46-02:00; FI"length; Fi
I"digest; F"%bf8ae73714a2efd07939f3eed96ec038I"source; FI"
(function() {
var _ref,
__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; };
Backbone.Form.editors.File = (function(_super) {
__extends(File, _super);
function File() {
_ref = File.__super__.constructor.apply(this, arguments);
return _ref;
}
File.prototype.tagName = 'div';
File.prototype.events = {
change: function(evt) {
return this.trigger("change", this);
},
focus: function() {
return this.trigger("focus", this);
},
blur: function() {
return this.trigger("blur", this);
},
'click [data-action=remove-document]': 'removeDocument'
};
File.prototype.removeDocument = function(evt) {
var docid;
evt.preventDefault();
docid = this.$('.uploaded-file').data("id");
return (new DocumentDestroyRequester(this, docid)).execute();
};
File.prototype.removeDocumentDOM = function() {
this.$('.uploaded-file').hide();
this.$('.uploaded-file .uploaded-file-name').text("");
this.$('.uploaded-file').data('id', "");
return this.$('.file-upload').show();
};
File.prototype.setProgressBar = function(context, value) {
context.$('.progress .bar').css('width', value + '%');
return context.$('.progress .bar').text(value + '%');
};
File.prototype.initialize = function(options) {
var input, prbar, that, upfil;
Backbone.Form.editors.Base.prototype.initialize.call(this, options);
input = this.$el.append("");
prbar = this.$el.append("
");
upfil = this.$el.append("");
this.$('.progress').hide();
this.$('.uploaded-file').hide();
this.on("destroyDocument:done", this.removeDocumentDOM, this);
that = this;
return this.$('.file-upload').fileupload({
url: "/proxy/documents",
type: "POST",
dataType: "json",
formData: {
title: that.schema.title,
api_token: window.api_token
},
progressall: function(evt, data) {
var progress;
progress = parseInt(data.loaded / data.total * 100, 10);
return that.setProgressBar(that, progress);
},
send: function(evt, data) {
that.$('.file-upload').hide();
return that.$('.progress').show();
},
done: function(evt, data) {
that.setProgressBar(that, "100");
that.$('.progress').hide();
that.$('.uploaded-file').show();
that.$('.uploaded-file .uploaded-file-name').text(data.result.file_file_name);
that.$('.uploaded-file').data('id', data.result.id);
return debug(data);
}
});
};
File.prototype.render = function() {
this.setValue(this.value);
return this;
};
File.prototype.getValue = function() {
return this.$('.uploaded-file').data('id');
};
File.prototype.setValue = function(value) {
var sp;
if (!value) {
return;
}
sp = value.split(":");
this.$('.uploaded-file').data('id', sp[0]);
if (sp.length > 1) {
this.$('.uploaded-file .uploaded-file-name').text(sp[1]);
this.$('.progress').hide();
this.$('.file-upload').hide();
return this.$('.uploaded-file').show();
}
};
File.prototype.focus = function() {
if (this.hasFocus) {
}
};
File.prototype.blur = function() {
if (!this.hasFocus) {
return;
}
return this.$el.blur();
};
return File;
})(Backbone.Form.editors.Base);
}).call(this);
; TI"dependency_digest; F"%74fae30c75805db4f90274ad21e4fe00I"required_paths; F["p/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/editors/file_editor.js.coffeeI"dependency_paths; F[{I" path; F"p/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/editors/file_editor.js.coffeeI"
mtime; FI"2013-01-17T19:14:46-02:00; FI"digest; F"%ffc8e0ff983512afc2f411f709f510c1I"
_version; F"%6776f581a4329e299531e1d52aa59832