0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/components/file-upload.js

24 lines
652 B
JavaScript
Raw Normal View History

var FileUpload = Ember.Component.extend({
_file: null,
uploadButtonText: 'Text',
uploadButtonDisabled: true,
change: function (event) {
this.set('uploadButtonDisabled', false);
this.sendAction('onAdd');
this._file = event.target.files[0];
},
actions: {
upload: function () {
var self = this;
if (!this.uploadButtonDisabled && self._file) {
self.sendAction('onUpload', self._file);
}
// Prevent double post by disabling the button.
this.set('uploadButtonDisabled', true);
}
}
});
export default FileUpload;