2015-02-12 21:22:32 -07:00
|
|
|
import Ember from 'ember';
|
2014-10-24 21:09:50 +00:00
|
|
|
// This is used by the dropdown initializer (and subsequently popovers) to manage closing & toggling
|
2014-09-29 12:17:27 +01:00
|
|
|
import BodyEventListener from 'ghost/mixins/body-event-listener';
|
|
|
|
|
2015-05-25 21:10:50 -05:00
|
|
|
export default Ember.Service.extend(Ember.Evented, BodyEventListener, {
|
2014-09-29 12:17:27 +01:00
|
|
|
bodyClick: function (event) {
|
|
|
|
/*jshint unused:false */
|
|
|
|
this.closeDropdowns();
|
|
|
|
},
|
2015-05-25 21:10:50 -05:00
|
|
|
|
2014-09-29 12:17:27 +01:00
|
|
|
closeDropdowns: function () {
|
|
|
|
this.trigger('close');
|
|
|
|
},
|
2015-05-25 21:10:50 -05:00
|
|
|
|
2014-09-29 12:17:27 +01:00
|
|
|
toggleDropdown: function (dropdownName, dropdownButton) {
|
|
|
|
this.trigger('toggle', {target: dropdownName, button: dropdownButton});
|
|
|
|
}
|
|
|
|
});
|