2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2014-03-31 08:07:05 +04:00
|
|
|
var DeleteAllController = Ember.Controller.extend({
|
2014-06-04 01:10:54 +04:00
|
|
|
actions: {
|
|
|
|
confirmAccept: function () {
|
2014-06-23 18:24:37 +04:00
|
|
|
var self = this;
|
2014-03-31 08:07:05 +04:00
|
|
|
|
2014-07-13 08:01:26 +04:00
|
|
|
ic.ajax.request(this.get('ghostPaths.url').api('db'), {
|
2014-07-01 13:39:01 +04:00
|
|
|
type: 'DELETE'
|
2014-06-23 18:24:37 +04:00
|
|
|
}).then(function () {
|
|
|
|
self.notifications.showSuccess('All content deleted from database.');
|
2014-12-11 19:55:14 +03:00
|
|
|
self.store.unloadAll('post');
|
|
|
|
self.store.unloadAll('tag');
|
2014-06-23 18:24:37 +04:00
|
|
|
}).catch(function (response) {
|
|
|
|
self.notifications.showErrors(response);
|
|
|
|
});
|
2014-06-04 01:10:54 +04:00
|
|
|
},
|
2014-03-31 08:07:05 +04:00
|
|
|
|
2014-06-04 01:10:54 +04:00
|
|
|
confirmReject: function () {
|
2014-06-23 18:24:37 +04:00
|
|
|
return false;
|
2014-06-04 01:10:54 +04:00
|
|
|
}
|
|
|
|
},
|
2014-03-31 08:07:05 +04:00
|
|
|
|
2014-06-04 01:10:54 +04:00
|
|
|
confirm: {
|
|
|
|
accept: {
|
2014-06-02 00:53:16 +04:00
|
|
|
text: 'Delete',
|
2014-08-06 15:34:08 +04:00
|
|
|
buttonClass: 'btn btn-red'
|
2014-03-31 08:07:05 +04:00
|
|
|
},
|
|
|
|
reject: {
|
2014-06-02 00:53:16 +04:00
|
|
|
text: 'Cancel',
|
2014-08-06 15:34:08 +04:00
|
|
|
buttonClass: 'btn btn-default btn-minor'
|
2014-03-31 08:07:05 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default DeleteAllController;
|