vendor/assets/javascripts/iugu-ux/editors/file_editor.js.coffee in iugu-ux-1.0.6 vs vendor/assets/javascripts/iugu-ux/editors/file_editor.js.coffee in iugu-ux-1.0.7

- old
+ new

@@ -24,12 +24,12 @@ @$('.uploaded-file .uploaded-file-name').text "" @$('.uploaded-file').data 'id', "" @$('.file-upload').show() setProgressBar: ( context, value ) -> - context.$('.progress .bar').css 'width', value + '%' - context.$('.progress .bar').text value + '%' + #context.$('.progress .bar').css 'width', value + '%' + context.$('.progress .bar').text value initialize: (options) -> Backbone.Form.editors.Base.prototype.initialize.call @, options input = @$el.append "<input class='file-upload' type='file'/>" prbar = @$el.append "<div class='progress'><div class='bar' style='width: 0%;'></div></div>" @@ -46,25 +46,29 @@ type: "POST" dataType: "json" formData: title: that.schema.title api_token: window.api_token - + maxFileSize: 2000000 progressall: (evt, data) -> - progress = parseInt data.loaded / data.total * 100, 10 + progress = "Enviando..." that.setProgressBar that, progress + error: -> + that.removeDocumentDOM() + that.$('.progress').hide() + alert("Não foi possível enviar o arquivo.") + send: (evt, data) -> that.$('.file-upload').hide() that.$('.progress').show() done: (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 - debug data render: -> @setValue(@value) @