2019-10-30 09:48:24 -04:00
|
|
|
import { next } from "@ember/runloop";
|
2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2019-11-07 16:38:28 -05:00
|
|
|
import { observes, on } from "discourse-common/utils/decorators";
|
2016-09-09 15:57:44 -04:00
|
|
|
|
2019-10-23 12:30:52 -04:00
|
|
|
export default Component.extend({
|
2016-09-09 15:57:44 -04:00
|
|
|
tagName: "label",
|
|
|
|
|
|
|
|
click(e) {
|
|
|
|
e.preventDefault();
|
2019-05-27 04:15:39 -04:00
|
|
|
this.onChange(this.radioValue);
|
2016-09-09 15:57:44 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
@observes("value")
|
|
|
|
@on("init")
|
|
|
|
updateVal() {
|
2019-05-27 04:15:39 -04:00
|
|
|
const checked = this.value === this.radioValue;
|
2019-10-30 09:48:24 -04:00
|
|
|
next(
|
2019-07-16 06:45:15 -04:00
|
|
|
() => (this.element.querySelector("input[type=radio]").checked = checked)
|
|
|
|
);
|
2016-09-09 15:57:44 -04:00
|
|
|
}
|
|
|
|
});
|