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';
|
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
const {Controller, inject} = Ember;
|
2015-05-25 21:10:50 -05:00
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
export default Controller.extend({
|
|
|
|
ghostPaths: inject.service('ghost-paths'),
|
|
|
|
notifications: inject.service(),
|
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
|
|
|
}
|
2015-10-28 11:36:45 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
confirmAccept() {
|
|
|
|
ajax(this.get('ghostPaths.url').api('db'), {
|
|
|
|
type: 'DELETE'
|
|
|
|
}).then(() => {
|
|
|
|
this.get('notifications').showAlert('All content deleted from database.', {type: 'success', key: 'all-content.delete.success'});
|
|
|
|
this.store.unloadAll('post');
|
|
|
|
this.store.unloadAll('tag');
|
|
|
|
}).catch((response) => {
|
|
|
|
this.get('notifications').showAPIError(response, {key: 'all-content.delete'});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
confirmReject() {
|
|
|
|
return false;
|
|
|
|
}
|
2014-03-31 00:07:05 -04:00
|
|
|
}
|
|
|
|
});
|