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
Joffrey JAFFEUX b3eb67976d
DEV: Upgrades to Ember 3.10 (#7871)
Co-Authored-By: majakomel <maja.komel@gmail.com>
2019-07-16 12:45:15 +02:00

27 lines
533 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.element).val();
if (this.selection === value) {
this.set("selection", undefined);
}
this.set("selection", value);
},
@computed("value", "selection")
checked(value, selection) {
return value === selection;
}
});