mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
194cf296e5
no issue - the modal component is using a native class but with the `@classic` decorator so it's still using pre-Glimmer component syntax where `this.args` doesn't exist - fixes Sentry error `ADMIN-4C`
40 lines
918 B
JavaScript
40 lines
918 B
JavaScript
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() {
|
|
this.close();
|
|
}
|
|
}
|
|
}
|