mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
f5e05c8d9f
Closes #2847
29 lines
654 B
JavaScript
29 lines
654 B
JavaScript
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];
|
|
},
|
|
|
|
onUpload: 'onUpload',
|
|
|
|
actions: {
|
|
upload: function () {
|
|
if (!this.uploadButtonDisabled && this._file) {
|
|
this.sendAction('onUpload', this._file);
|
|
}
|
|
|
|
// Prevent double post by disabling the button.
|
|
this.set('uploadButtonDisabled', true);
|
|
}
|
|
}
|
|
});
|
|
|
|
export default FileUpload;
|