2021-04-12 13:35:50 +03:00
|
|
|
import ModalBase from 'ghost-admin/components/modal-base';
|
|
|
|
import classic from 'ember-classic-decorator';
|
|
|
|
import {action} from '@ember/object';
|
|
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
|
|
|
|
// TODO: update modals to work fully with Glimmer components
|
|
|
|
@classic
|
|
|
|
export default class ModalPostPreviewComponent extends ModalBase {
|
|
|
|
@tracked role;
|
|
|
|
|
|
|
|
// TODO: rename to confirm() when modals have full Glimmer support
|
|
|
|
@action
|
|
|
|
confirmAction() {
|
|
|
|
this.confirm(this.role);
|
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
close(event) {
|
|
|
|
event?.preventDefault?.();
|
|
|
|
this.closeModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
setRoleFromModel() {
|
|
|
|
this.role = this.model;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions = {
|
|
|
|
confirm() {
|
|
|
|
this.confirmAction(...arguments);
|
|
|
|
},
|
|
|
|
|
|
|
|
// needed because ModalBase uses .send() for keyboard events
|
|
|
|
closeModal() {
|
2021-06-01 18:50:02 +03:00
|
|
|
this.close();
|
2021-04-12 13:35:50 +03:00
|
|
|
}
|
2022-02-10 13:41:36 +03:00
|
|
|
};
|
2021-04-12 13:35:50 +03:00
|
|
|
}
|