Ghost/ghost/admin/app/components/gh-dropdown-button.js

25 lines
650 B
JavaScript
Raw Normal View History

import Component from '@ember/component';
import DropdownMixin from 'ghost-admin/mixins/dropdown-mixin';
import {inject as service} from '@ember/service';
2014-09-28 19:39:25 +04:00
export default Component.extend(DropdownMixin, {
dropdown: service(),
2014-09-28 19:39:25 +04:00
tagName: 'button',
attributeBindings: ['href', 'role'],
2015-03-07 23:35:45 +03:00
role: 'button',
// matches with the dropdown this button toggles
2014-09-28 19:39:25 +04:00
dropdownName: null,
// Notify dropdown service this dropdown should be toggled
click(event) {
2014-09-28 19:39:25 +04:00
this._super(event);
this.dropdown.toggleDropdown(this.dropdownName, this);
if (this.tagName === 'a') {
return false;
}
2014-09-28 19:39:25 +04:00
}
});