o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1358772537.955107 y:@value"e{I"
class:EFI"ProcessedAsset; FI"logical_path; FI"#iugu-ux/editors/file_editor.js; FI"
pathname; FI"p/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/editors/file_editor.js.coffee; FI"content_type; FI"application/javascript; FI"
mtime; FI"2013-01-17T19:14:46-02:00; FI"length; FiíI"digest; F"%8e0ebcf3fd0fd1402e432fde84807c3dI"source; FI"í(function() {
var __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() {
return File.__super__.constructor.apply(this, arguments);
}
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"%824be627a908d98ca39a9f7bef3cb7d0I"required_paths; F[I"p/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/editors/file_editor.js.coffee; FI"dependency_paths; F[{I" path; FI"p/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/editors/file_editor.js.coffee; FI"
mtime; FI"2013-01-17T19:14:46-02:00; FI"digest; F"%6717909d957824bf97758974b16b1d2bI"
_version; F"%9f3b95dd7ea3030dc35985c0a8020862