A platform for community discussion. Free, open, simple.
DEV: Convert PreferenceCheckbox to gjs (#24817)
Jarek Radosz3999f3e826c8
diff --git a/app/assets/javascripts/discourse/app/components/preference-checkbox.gjs b/app/assets/javascripts/discourse/app/components/preference-checkbox.gjsnew file mode 100644index 00000000000..ada2b66d7ae--- /dev/null+++ b/app/assets/javascripts/discourse/app/components/preference-checkbox.gjs@@ -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;diff --git a/app/assets/javascripts/discourse/app/components/preference-checkbox.hbs b/app/assets/javascripts/discourse/app/components/preference-checkbox.hbsdeleted file mode 100644index 459da802c2a..00000000000--- a/app/assets/javascripts/discourse/app/components/preference-checkbox.hbs+++ /dev/null@@ -1,8 +0,0 @@-<label class="checkbox-label">- <Input- @type="checkbox"- disabled={{this.disabled}}- @checked={{this.checked}}- />- {{this.label}}-</label>\ No newline at end of filediff --git a/app/assets/javascripts/discourse/app/components/preference-checkbox.js b/app/assets/javascripts/discourse/app/components/preference-checkbox.jsdeleted file mode 100644index 23620480f90..00000000000--- a/app/assets/javascripts/discourse/app/components/preference-checkbox.js+++ /dev/null@@ -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;- },-});