2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2015-05-27 03:41:12 +03:00
|
|
|
import {request as ajax} from 'ic-ajax';
|
|
|
|
|
|
|
|
export default Ember.Controller.extend({
|
2015-05-26 05:10:50 +03:00
|
|
|
ghostPaths: Ember.inject.service('ghost-paths'),
|
|
|
|
notifications: Ember.inject.service(),
|
|
|
|
|
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
|
|
|
|
2015-05-27 03:41:12 +03:00
|
|
|
ajax(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 () {
|
2015-05-26 05:10:50 +03:00
|
|
|
self.get('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) {
|
2015-05-26 05:10:50 +03:00
|
|
|
self.get('notifications').showErrors(response);
|
2014-06-23 18:24:37 +04:00
|
|
|
});
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|