mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 18:52:05 +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.
19 lines
598 B
JavaScript
19 lines
598 B
JavaScript
import Ember from 'ember';
|
|
// This is used by the dropdown initializer (and subsequently popovers) to manage closing & toggling
|
|
import BodyEventListener from 'ghost/mixins/body-event-listener';
|
|
|
|
export default Ember.Service.extend(Ember.Evented, BodyEventListener, {
|
|
bodyClick: function (event) {
|
|
/*jshint unused:false */
|
|
this.closeDropdowns();
|
|
},
|
|
|
|
closeDropdowns: function () {
|
|
this.trigger('close');
|
|
},
|
|
|
|
toggleDropdown: function (dropdownName, dropdownButton) {
|
|
this.trigger('toggle', {target: dropdownName, button: dropdownButton});
|
|
}
|
|
});
|