2016-06-30 13:21:47 +03:00
|
|
|
import Service from 'ember-service';
|
|
|
|
import Evented from 'ember-evented';
|
2017-04-05 16:08:29 +03:00
|
|
|
// This is used by the dropdown initializer 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
|
|
|
export default Service.extend(Evented, BodyEventListener, {
|
2016-11-14 16:16:51 +03:00
|
|
|
bodyClick() {
|
2014-09-29 15:17:27 +04:00
|
|
|
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});
|
|
|
|
}
|
|
|
|
});
|