discourse/app/assets/javascripts/admin/addon/components/site-settings/bool.js
David Taylor a433b30650
DEV: Convert admin component definitions to native class syntax (#20311)
This conversion was achieved using the ember-native-class-codemod, plus a handful of manual fixes/tweaks
2023-02-23 15:32:53 +00:00

19 lines
413 B
JavaScript

import { computed } from "@ember/object";
import Component from "@ember/component";
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");
return value;
}
}