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

18 lines
403 B
Plaintext
Raw Normal View History

2018-06-15 11:03:24 -04:00
import { observes, on } from "ember-addons/ember-computed-decorators";
2016-09-09 15:57:44 -04:00
export default Ember.Component.extend({
2018-06-15 11:03:24 -04:00
tagName: "label",
2016-09-09 15:57:44 -04:00
click(e) {
e.preventDefault();
this.onChange(this.radioValue);
2016-09-09 15:57:44 -04:00
},
2018-06-15 11:03:24 -04:00
@observes("value")
@on("init")
2016-09-09 15:57:44 -04:00
updateVal() {
const checked = this.value === this.radioValue;
2018-06-15 11:03:24 -04:00
Ember.run.next(() => this.$("input[type=radio]").prop("checked", checked));
2016-09-09 15:57:44 -04:00
}
});