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

19 lines
540 B
JavaScript
Raw Normal View History

import Service from 'ember-service';
import Evented from 'ember-evented';
// This is used by the dropdown initializer to manage closing & toggling
import BodyEventListener from 'ghost-admin/mixins/body-event-listener';
2014-09-29 15:17:27 +04:00
export default Service.extend(Evented, BodyEventListener, {
bodyClick() {
2014-09-29 15:17:27 +04:00
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});
}
});