1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/components/gh-fullscreen-modal.js
Kevin Ansfield c223729fee Added automatic filter of members list after CSV import
requires 8ceabbcfba

- if the API responds with `meta.import_label` after an import, use it to reset and apply the filter across the members list so that it's quick to see the results of the import and perform further bulk actions (coming later)
- added ability to pass arguments through `<GhFullscreenModal>`'s `@confirm` action
- added a `console.error()` call to the members csv import so that any underlying error is not completely lost by the custom error handling
2020-07-23 14:15:07 +01:00

60 lines
1.5 KiB
JavaScript

import Component from '@ember/component';
import RSVP from 'rsvp';
import {computed} from '@ember/object';
import {A as emberA} from '@ember/array';
import {isBlank} from '@ember/utils';
import {run} from '@ember/runloop';
import {inject as service} from '@ember/service';
const FullScreenModalComponent = Component.extend({
dropdown: service(),
model: null,
modifier: null,
modalPath: computed('modal', function () {
return `modal-${this.modal || 'unknown'}`;
}),
modalClasses: computed('modifiers', function () {
let modalClass = 'fullscreen-modal';
let modifiers = (this.modifier || '').split(' ');
let modalClasses = emberA([modalClass]);
modifiers.forEach((modifier) => {
if (!isBlank(modifier)) {
let className = `${modalClass}-${modifier}`;
modalClasses.push(className);
}
});
return modalClasses.join(' ');
}),
didInsertElement() {
run.schedule('afterRender', this, function () {
this.dropdown.closeDropdowns();
});
},
actions: {
close() {
return this.close(...arguments);
},
confirm() {
return this.confirm(...arguments);
},
clickOverlay() {
this.send('close');
}
},
// Allowed actions
close: () => RSVP.resolve(),
confirm: () => RSVP.resolve()
});
export default FullScreenModalComponent;