discourse/app/assets/javascripts/wizard/components/radio-button.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
491 B
JavaScript
Raw Normal View History

import { next } from "@ember/runloop";
import Component from "@ember/component";
import { observes, on } from "discourse-common/utils/decorators";
2016-09-09 15:57:44 -04:00
export default Component.extend({
2016-09-09 15:57:44 -04:00
tagName: "label",
click(e) {
e.preventDefault();
this.onChange(this.radioValue);
2016-09-09 15:57:44 -04:00
},
@observes("value")
@on("init")
updateVal() {
const checked = this.value === this.radioValue;
next(
() => (this.element.querySelector("input[type=radio]").checked = checked)
);
2016-09-09 15:57:44 -04:00
},
});