mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
c3a496fe9f
no issue - Adds action view with import/export csv options
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}/members/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.closeDisabled) {
|
|
this._super(...arguments);
|
|
}
|
|
}
|
|
}
|
|
});
|