mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
61e5ebdd2f
issue #5409 `notifications.showErrors` was historically used to display multiple error notifications whether from validation errors or responses form the API. This usage needs to be reviewed as inline validations should handle the validation side and we should be displaying alerts for actual errors. Eventually `notifications.showErrors` should be left unused and therefore removed.
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
import Ember from 'ember';
|
|
import {request as ajax} from 'ic-ajax';
|
|
|
|
export default Ember.Controller.extend({
|
|
ghostPaths: Ember.inject.service('ghost-paths'),
|
|
notifications: Ember.inject.service(),
|
|
|
|
actions: {
|
|
confirmAccept: function () {
|
|
var self = this;
|
|
|
|
ajax(this.get('ghostPaths.url').api('db'), {
|
|
type: 'DELETE'
|
|
}).then(function () {
|
|
self.get('notifications').showAlert('All content deleted from database.', {type: 'success'});
|
|
self.store.unloadAll('post');
|
|
self.store.unloadAll('tag');
|
|
}).catch(function (response) {
|
|
self.get('notifications').showAPIError(response);
|
|
});
|
|
},
|
|
|
|
confirmReject: function () {
|
|
return false;
|
|
}
|
|
},
|
|
|
|
confirm: {
|
|
accept: {
|
|
text: 'Delete',
|
|
buttonClass: 'btn btn-red'
|
|
},
|
|
reject: {
|
|
text: 'Cancel',
|
|
buttonClass: 'btn btn-default btn-minor'
|
|
}
|
|
}
|
|
});
|