Ghost/ghost/admin/app/components/modal-import-members.js
Rish c3a496fe9f Added csv import/export for members
no issue

- Adds action view with import/export csv options
2019-10-04 15:14:20 +05:30

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);
}
}
}
});