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/radio-button.js.es6

21 lines
513 B
JavaScript

import computed from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({
tagName : "input",
type : "radio",
attributeBindings : ["name", "type", "value", "checked:checked", "disabled:disabled"],
click() {
const value = this.$().val();
if (this.get("selection") === value) {
this.set("selection", undefined);
}
this.set("selection", value);
},
@computed('value', 'selection')
checked(value, selection) {
return value === selection;
},
});