2017-08-22 10:53:26 +03:00
|
|
|
import Component from '@ember/component';
|
2016-05-24 15:06:59 +03:00
|
|
|
import DropdownMixin from 'ghost-admin/mixins/dropdown-mixin';
|
2017-10-30 12:38:01 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2014-09-28 19:39:25 +04:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
export default Component.extend(DropdownMixin, {
|
2018-01-11 20:43:23 +03:00
|
|
|
dropdown: service(),
|
|
|
|
|
2014-09-28 19:39:25 +04:00
|
|
|
tagName: 'button',
|
2017-04-11 16:39:45 +03:00
|
|
|
attributeBindings: ['href', 'role'],
|
2015-03-07 23:35:45 +03:00
|
|
|
role: 'button',
|
2014-10-25 01:09:50 +04:00
|
|
|
|
|
|
|
// matches with the dropdown this button toggles
|
2014-09-28 19:39:25 +04:00
|
|
|
dropdownName: null,
|
2014-10-25 01:09:50 +04:00
|
|
|
|
|
|
|
// Notify dropdown service this dropdown should be toggled
|
2015-10-28 14:36:45 +03:00
|
|
|
click(event) {
|
2014-09-28 19:39:25 +04:00
|
|
|
this._super(event);
|
2019-03-06 16:53:54 +03:00
|
|
|
this.dropdown.toggleDropdown(this.dropdownName, this);
|
2017-04-11 16:39:45 +03:00
|
|
|
|
2019-03-06 16:53:54 +03:00
|
|
|
if (this.tagName === 'a') {
|
2017-04-11 16:39:45 +03:00
|
|
|
return false;
|
|
|
|
}
|
2014-09-28 19:39:25 +04:00
|
|
|
}
|
|
|
|
});
|