Ghost/core/client/app/controllers/modals/delete-all.js

39 lines
1.0 KiB
JavaScript
Raw Normal View History

2015-02-13 07:22:32 +03:00
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;
2014-03-31 08:07:05 +04:00
ajax(this.get('ghostPaths.url').api('db'), {
type: 'DELETE'
}).then(function () {
self.get('notifications').showSuccess('All content deleted from database.');
self.store.unloadAll('post');
self.store.unloadAll('tag');
}).catch(function (response) {
self.get('notifications').showErrors(response);
});
},
2014-03-31 08:07:05 +04:00
confirmReject: function () {
return false;
}
},
2014-03-31 08:07:05 +04:00
confirm: {
accept: {
text: 'Delete',
2014-08-06 15:34:08 +04:00
buttonClass: 'btn btn-red'
2014-03-31 08:07:05 +04:00
},
reject: {
text: 'Cancel',
2014-08-06 15:34:08 +04:00
buttonClass: 'btn btn-default btn-minor'
2014-03-31 08:07:05 +04:00
}
}
});