mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
1bd4b5cda7
no issue - show a delete icon when a snippet is hovered in plus/slash menus - show a confirmation dialog when the delete icon is clicked - keep menus open whilst displaying the delete confirmation dialog
28 lines
715 B
JavaScript
28 lines
715 B
JavaScript
import ModalComponent from 'ghost-admin/components/modal-base';
|
|
import {alias} from '@ember/object/computed';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default ModalComponent.extend({
|
|
router: service(),
|
|
notifications: service(),
|
|
|
|
snippet: alias('model'),
|
|
|
|
actions: {
|
|
confirm() {
|
|
this.deleteSnippet.perform();
|
|
}
|
|
},
|
|
|
|
deleteSnippet: task(function* (snippet) {
|
|
try {
|
|
yield this.confirm(snippet);
|
|
} catch (error) {
|
|
this.notifications.showAPIError(error, {key: 'snippet.delete.failed'});
|
|
} finally {
|
|
this.send('closeModal');
|
|
}
|
|
}).drop()
|
|
});
|