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

19 lines
598 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
2014-09-29 15:17:27 +04:00
import BodyEventListener from 'ghost/mixins/body-event-listener';
export default Ember.Service.extend(Ember.Evented, BodyEventListener, {
2014-09-29 15:17:27 +04:00
bodyClick: function (event) {
/*jshint unused:false */
this.closeDropdowns();
},
2014-09-29 15:17:27 +04:00
closeDropdowns: function () {
this.trigger('close');
},
2014-09-29 15:17:27 +04:00
toggleDropdown: function (dropdownName, dropdownButton) {
this.trigger('toggle', {target: dropdownName, button: dropdownButton});
}
});