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