mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 08:54:36 +03:00
ad5528b078
closes TryGhost/Ghost#9477 - remove ember-invoke-action in favor of straight function calls
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
import ModalComponent from 'ghost-admin/components/modal-base';
|
|
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
|
import {computed} from '@ember/object';
|
|
|
|
export default ModalComponent.extend({
|
|
labelText: 'Select or drag-and-drop a CSV File',
|
|
|
|
response: null,
|
|
closeDisabled: false,
|
|
|
|
// Allowed actions
|
|
confirm: () => {},
|
|
|
|
uploadUrl: computed(function () {
|
|
return `${ghostPaths().apiRoot}/subscribers/csv/`;
|
|
}),
|
|
|
|
actions: {
|
|
uploadStarted() {
|
|
this.set('closeDisabled', true);
|
|
},
|
|
|
|
uploadFinished() {
|
|
this.set('closeDisabled', false);
|
|
},
|
|
|
|
uploadSuccess(response) {
|
|
this.set('response', response.meta.stats);
|
|
// invoke the passed in confirm action
|
|
this.confirm();
|
|
},
|
|
|
|
confirm() {
|
|
// noop - we don't want the enter key doing anything
|
|
},
|
|
|
|
closeModal() {
|
|
if (!this.get('closeDisabled')) {
|
|
this._super(...arguments);
|
|
}
|
|
}
|
|
}
|
|
});
|