2023-02-23 23:32:53 +08:00
|
|
|
import { classNames } from "@ember-decorators/component";
|
|
|
|
import { computed } from "@ember/object";
|
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";
|
2022-05-13 23:56:23 +08:00
|
|
|
import { dasherize } from "@ember/string";
|
2015-08-21 01:43:12 +08:00
|
|
|
|
2023-02-23 23:32:53 +08:00
|
|
|
@classNames("embed-setting")
|
|
|
|
export default class EmbeddingSetting extends Component {
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("field")
|
2015-08-21 01:43:12 +08:00
|
|
|
inputId(field) {
|
2022-05-13 23:56:23 +08:00
|
|
|
return dasherize(field);
|
2023-02-23 23:32:53 +08:00
|
|
|
}
|
2015-08-21 01:43:12 +08:00
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("field")
|
2015-08-21 01:43:12 +08:00
|
|
|
translationKey(field) {
|
|
|
|
return `admin.embedding.${field}`;
|
2023-02-23 23:32:53 +08:00
|
|
|
}
|
2015-08-21 01:43:12 +08:00
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("type")
|
2015-08-21 01:43:12 +08:00
|
|
|
isCheckbox(type) {
|
|
|
|
return type === "checkbox";
|
2023-02-23 23:32:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@computed("value")
|
|
|
|
get checked() {
|
|
|
|
return !!this.value;
|
|
|
|
}
|
2015-08-21 01:43:12 +08:00
|
|
|
|
2023-07-19 04:02:07 +08:00
|
|
|
set checked(value) {
|
2023-02-23 23:32:53 +08:00
|
|
|
this.set("value", value);
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|