mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 08:34:39 +08:00
18 lines
395 B
JavaScript
18 lines
395 B
JavaScript
import Component from "@ember/component";
|
|
import { computed } from "@ember/object";
|
|
import { isEmpty } from "@ember/utils";
|
|
|
|
export default class Bool extends Component {
|
|
@computed("value")
|
|
get enabled() {
|
|
if (isEmpty(this.value)) {
|
|
return false;
|
|
}
|
|
return this.value.toString() === "true";
|
|
}
|
|
|
|
set enabled(value) {
|
|
this.set("value", value ? "true" : "false");
|
|
}
|
|
}
|