mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-20 20:42:44 -05:00
25 lines
706 B
JavaScript
25 lines
706 B
JavaScript
import computed from 'ember-addons/ember-computed-decorators';
|
|
import { iconHTML } from 'discourse/helpers/fa-icon';
|
|
|
|
export default Em.Component.extend({
|
|
tagName: "li",
|
|
attributeBindings: ["data-poll-option-id"],
|
|
|
|
"data-poll-option-id": Em.computed.alias("option.id"),
|
|
|
|
@computed("option.selected", "isMultiple")
|
|
optionIcon(selected, isMultiple) {
|
|
if (isMultiple) {
|
|
return iconHTML(selected ? 'check-square-o' : 'square-o');
|
|
} else {
|
|
return iconHTML(selected ? 'dot-circle-o' : 'circle-o');
|
|
}
|
|
},
|
|
|
|
click(e) {
|
|
// ensure we're not clicking on a link
|
|
if ($(e.target).closest("a").length === 0) {
|
|
this.sendAction("toggle", this.get("option"));
|
|
}
|
|
}
|
|
});
|