discourse/app/assets/javascripts/admin/components/site-settings/bool.js.es6

20 lines
440 B
JavaScript

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