Ghost/ghost/admin/app/services/dropdown.js

21 lines
594 B
JavaScript
Raw Normal View History

2015-02-13 07:22:32 +03:00
import Ember from 'ember';
// This is used by the dropdown initializer (and subsequently popovers) to manage closing & toggling
import BodyEventListener from 'ghost-admin/mixins/body-event-listener';
2014-09-29 15:17:27 +04: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();
},
closeDropdowns() {
2014-09-29 15:17:27 +04:00
this.trigger('close');
},
toggleDropdown(dropdownName, dropdownButton) {
2014-09-29 15:17:27 +04:00
this.trigger('toggle', {target: dropdownName, button: dropdownButton});
}
});