DEV: Convert PreferenceCheckbox to gjs (#24817)
This commit is contained in:
parent
c6a2c80441
commit
3999f3e826
|
@ -0,0 +1,19 @@
|
|||
import { Input } from "@ember/component";
|
||||
import concatClass from "discourse/helpers/concat-class";
|
||||
import i18n from "discourse-common/helpers/i18n";
|
||||
|
||||
const PreferenceCheckbox = <template>
|
||||
<div class={{concatClass "controls" @class}} ...attributes>
|
||||
<label class="checkbox-label">
|
||||
<Input @type="checkbox" @checked={{@checked}} disabled={{@disabled}} />
|
||||
|
||||
{{#if @labelCount}}
|
||||
{{i18n @labelKey count=@labelCount}}
|
||||
{{else}}
|
||||
{{i18n @labelKey}}
|
||||
{{/if}}
|
||||
</label>
|
||||
</div>
|
||||
</template>;
|
||||
|
||||
export default PreferenceCheckbox;
|
|
@ -1,8 +0,0 @@
|
|||
<label class="checkbox-label">
|
||||
<Input
|
||||
@type="checkbox"
|
||||
disabled={{this.disabled}}
|
||||
@checked={{this.checked}}
|
||||
/>
|
||||
{{this.label}}
|
||||
</label>
|
|
@ -1,27 +0,0 @@
|
|||
import Component from "@ember/component";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["controls"],
|
||||
|
||||
@discourseComputed("labelKey", "labelCount")
|
||||
label(labelKey, labelCount) {
|
||||
if (labelCount) {
|
||||
return I18n.t(labelKey, { count: labelCount });
|
||||
} else {
|
||||
return I18n.t(labelKey);
|
||||
}
|
||||
},
|
||||
|
||||
change() {
|
||||
const warning = this.warning;
|
||||
|
||||
if (warning && this.checked) {
|
||||
this.warning();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
});
|
Loading…
Reference in New Issue