2014-10-25 01:09:50 +04:00
|
|
|
// This is used by the dropdown initializer (and subsequently popovers) to manage closing & toggling
|
2014-09-29 15:17:27 +04:00
|
|
|
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});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
export default DropdownService;
|