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