Ghost/ghost/admin/app/components/gh-basic-dropdown.js
Kevin Ansfield 6dabb84e0a 🐛 fix sticky dropdown links (#621)
closes https://github.com/TryGhost/Ghost/issues/8269

- swaps the usage of our custom `gh-dropdown` component in the user menu dropdown for the `ember-wormhole` based `ember-basic-dropdown` that is used elsewhere in the app and will fully replace `gh-dropdown` in the future
- adds `gh-basic-dropdown` component that extends from `ember-basic-dropdown` and hooks into our `dropdown` service so that we can programatically close dropdowns from disparate areas of the app
- modifies the `body-event-listener` mixin to pass the click event through to it's consumers
- modifies the `bodyClick` handler in the `dropdown` service to check if the click actually originated from an ember-basic-dropdown element - this body click handler will go away once we've fully switched to `gh-basic-dropdown`
- adds `ember-native-dom-helpers` to provide consistency between acceptance and integration tests (this is the start of another refactor, eventually this addon will disappear as part of ember's [grand testing unification project](https://github.com/rwjblue/rfcs/blob/42/text/0000-grand-testing-unification.md))
2017-04-05 15:26:01 +01:00

20 lines
532 B
JavaScript

import BasicDropdown from 'ember-basic-dropdown/components/basic-dropdown';
import layout from 'ember-basic-dropdown/templates/components/basic-dropdown';
import injectService from 'ember-service/inject';
export default BasicDropdown.extend({
dropdown: injectService(),
layout,
didInsertElement() {
this._super(...arguments);
this.get('dropdown').on('close', this, this.close);
},
willDestroyElement() {
this._super(...arguments);
this.get('dropdown').off('close');
}
});