discourse/app/assets/javascripts/admin/addon/components/site-settings/bool.js
2020-12-01 15:31:26 -03:00

20 lines
455 B
JavaScript

import Component from "@ember/component";
import discourseComputed from "discourse-common/utils/decorators";
import { isEmpty } from "@ember/utils";
export default Component.extend({
@discourseComputed("value")
enabled: {
get(value) {
if (isEmpty(value)) {
return false;
}
return value.toString() === "true";
},
set(value) {
this.set("value", value ? "true" : "false");
return value;
},
},
});