mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
import BodyEventListener from 'ghost/mixins/body-event-listener';
|
|
|
|
var DropdownService = Ember.Object.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});
|
|
}
|
|
});
|
|
|
|
var dropdownInitializer = {
|
|
name: 'dropdown',
|
|
|
|
initialize: function (container, application) {
|
|
application.register('dropdown:service', DropdownService);
|
|
|
|
application.inject('component:gh-dropdown', 'dropdown', 'dropdown:service');
|
|
application.inject('component:gh-dropdown-button', 'dropdown', 'dropdown:service');
|
|
application.inject('controller:modals.delete-post', 'dropdown', 'dropdown:service');
|
|
application.inject('controller:modals.transfer-owner', 'dropdown', 'dropdown:service');
|
|
application.inject('route:application', 'dropdown', 'dropdown:service');
|
|
}
|
|
};
|
|
|
|
export default dropdownInitializer;
|