This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/select-box/select-box-row.js.es6
Joffrey JAFFEUX 861dbe3b51 select-box refactoring
- more flexibility (allows custom title)
- less re-render
- more robustness
2017-08-29 12:25:54 +02:00

37 lines
772 B
JavaScript

import computed from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
layoutName: "components/select-box/select-box-row",
classNames: "select-box-row",
tagName: "li",
attributeBindings: ["title"],
classNameBindings: ["isHighlighted:is-highlighted"],
@computed("titleForRow")
title(titleForRow) {
return titleForRow(this);
},
@computed("templateForRow")
template(templateForRow) {
return templateForRow(this);
},
@computed("shouldHighlightRow", "lastHovered", "value")
isHighlighted(shouldHighlightRow) {
return shouldHighlightRow(this);
},
mouseEnter() {
this.sendAction("onHover", this.get("content"));
},
click() {
this.sendAction("onSelect", this.get("content"));
}
});