2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2019-11-08 05:38:28 +08:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2019-11-01 01:37:24 +08:00
|
|
|
import { isEmpty } from "@ember/utils";
|
2015-08-22 02:39:21 +08:00
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend({
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("value")
|
2015-08-22 02:39:21 +08:00
|
|
|
enabled: {
|
|
|
|
get(value) {
|
2019-11-01 01:37:24 +08:00
|
|
|
if (isEmpty(value)) {
|
2015-08-22 02:39:21 +08:00
|
|
|
return false;
|
|
|
|
}
|
2018-03-05 08:04:23 +08:00
|
|
|
return value.toString() === "true";
|
2015-08-22 02:39:21 +08:00
|
|
|
},
|
|
|
|
set(value) {
|
|
|
|
this.set("value", value ? "true" : "false");
|
|
|
|
return value;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|