Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Add attachment to note implemented #253

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
File upload progress added
  • Loading branch information
Valery Kalashnikov committed Apr 24, 2015
commit 58f8db8a14af924133e8dca7450063285998bb7b
9 changes: 9 additions & 0 deletions app/assets/javascripts/views/note_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Fulcrum.NoteForm = Fulcrum.FormView.extend({
var fileObject = fileInput && fileInput.files[0];
if (fileObject !== undefined) {
this.model.set('attachment', fileObject);
$(this.el).append('<div class="progress-value" style="">5%</div>');
}
this.disableForm();

Expand All @@ -48,6 +49,7 @@ Fulcrum.NoteForm = Fulcrum.FormView.extend({
});
}
});
this.model.on('progress', _.bind(this._handleProgress, this));
},

render: function() {
Expand Down Expand Up @@ -77,5 +79,12 @@ Fulcrum.NoteForm = Fulcrum.FormView.extend({
enableForm: function() {
this.$('input,textarea').removeAttr('disabled');
this.$('input[type="button"]').removeClass('saving');
},

_handleProgress: function(value) {
var progressValue = this.$el.find('.progress-value');
if (progressValue.length !== 0) {
progressValue.html(parseInt(value * 100)+"%");
}
}
});