mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 09:03:36 +08:00
32 lines
785 B
JavaScript
32 lines
785 B
JavaScript
import Ember from 'ember';
|
|
|
|
/**
|
|
Button which has an attached dropdown menu containing an item list.
|
|
*/
|
|
export default Ember.Component.extend({
|
|
layoutName: 'components/ui/dropdown-button',
|
|
classNames: ['dropdown', 'btn-group'],
|
|
classNameBindings: ['itemCountClass', 'class'],
|
|
|
|
label: 'Controls',
|
|
icon: 'ellipsis-v',
|
|
buttonClass: 'btn btn-default',
|
|
menuClass: '',
|
|
items: null,
|
|
|
|
dropdownMenuClass: Ember.computed('menuClass', function() {
|
|
return 'dropdown-menu '+this.get('menuClass');
|
|
}),
|
|
|
|
itemCountClass: Ember.computed('items.length', function() {
|
|
var count = this.get('items.length');
|
|
return count ? 'item-count-'+this.get('items.length') : '';
|
|
}),
|
|
|
|
actions: {
|
|
buttonClick: function() {
|
|
this.sendAction('buttonClick');
|
|
}
|
|
}
|
|
});
|