mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 04:43:12 +03:00
4184543307
refs https://github.com/TryGhost/Team/issues/973 - show confirmation modal instead of immediately replacing content of the existing snippet
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.snippetRecord'),
|
|
|
|
actions: {
|
|
confirm() {
|
|
this.updateSnippet.perform();
|
|
}
|
|
},
|
|
|
|
updateSnippet: task(function* () {
|
|
try {
|
|
yield this.confirm();
|
|
} catch (error) {
|
|
this.notifications.showAPIError(error, {key: 'snippet.update.failed'});
|
|
} finally {
|
|
this.send('closeModal');
|
|
}
|
|
}).drop()
|
|
});
|