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