mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
c3ad1ae9e2
No Issue - Switches to the newer style of dependency injection. - Instead of injection Controllers via "needs," use Ember.inject.controller(). - Get rid of initializers that were only injecting objects into various factories. Converts these objects into Ember.Service objects and declaratively inject them where needed via Ember.inject.service(). The added benefit to this is that it's no longer a mystery where these properties/methods come from and it's straightforward to inject them where needed.
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
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;
|
|
|
|
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);
|
|
});
|
|
},
|
|
|
|
confirmReject: function () {
|
|
return false;
|
|
}
|
|
},
|
|
|
|
confirm: {
|
|
accept: {
|
|
text: 'Delete',
|
|
buttonClass: 'btn btn-red'
|
|
},
|
|
reject: {
|
|
text: 'Cancel',
|
|
buttonClass: 'btn btn-default btn-minor'
|
|
}
|
|
}
|
|
});
|