mirror of
https://github.com/discourse/discourse.git
synced 2025-01-17 05:53:16 +08:00
4aa7a89371
Converts the following site setting components: * Bool * Category * Colors * Category * CompactList * EmojiList
34 lines
827 B
Plaintext
34 lines
827 B
Plaintext
import Component from "@glimmer/component";
|
|
import { tracked } from "@glimmer/tracking";
|
|
import { on } from "@ember/modifier";
|
|
import { action } from "@ember/object";
|
|
import { htmlSafe } from "@ember/template";
|
|
import { isEmpty } from "@ember/utils";
|
|
|
|
export default class Bool extends Component {
|
|
@tracked
|
|
enabled = isEmpty(this.args.value)
|
|
? false
|
|
: this.args.value.toString() === "true";
|
|
|
|
@action
|
|
onToggle(event) {
|
|
if (event.target.checked) {
|
|
this.args.changeValueCallback("true");
|
|
} else {
|
|
this.args.changeValueCallback("false");
|
|
}
|
|
}
|
|
|
|
<template>
|
|
<label class="checkbox-label">
|
|
<input
|
|
{{on "input" this.onToggle}}
|
|
type="checkbox"
|
|
checked={{this.enabled}}
|
|
/>
|
|
<span>{{htmlSafe @setting.description}}</span>
|
|
</label>
|
|
</template>
|
|
}
|