2016-07-28 22:30:38 -04:00
|
|
|
import computed from 'ember-addons/ember-computed-decorators';
|
|
|
|
import { iconHTML } from 'discourse/helpers/fa-icon';
|
|
|
|
|
2015-04-23 13:33:29 -04:00
|
|
|
export default Em.Component.extend({
|
|
|
|
tagName: "li",
|
2016-07-28 22:30:38 -04:00
|
|
|
attributeBindings: ["data-poll-option-id"],
|
2015-04-23 13:33:29 -04:00
|
|
|
|
|
|
|
"data-poll-option-id": Em.computed.alias("option.id"),
|
|
|
|
|
2016-07-28 22:30:38 -04:00
|
|
|
@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');
|
|
|
|
}
|
2015-04-23 13:33:29 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
click(e) {
|
|
|
|
// ensure we're not clicking on a link
|
|
|
|
if ($(e.target).closest("a").length === 0) {
|
|
|
|
this.sendAction("toggle", this.get("option"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|