mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 02:43:42 +08:00
20 lines
455 B
JavaScript
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;
|
|
},
|
|
},
|
|
});
|