mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
19 lines
635 B
JavaScript
19 lines
635 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';
|
|
|
|
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});
|
|
}
|
|
});
|
|
|
|
export default DropdownService;
|