From 0f7e4d2eaa0b6e51b3ba0bf5a3eaa1e7baf110ab Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Wed, 29 Nov 2023 13:00:36 +0100 Subject: [PATCH] DEV: Convert input-tip to gjs (#24624) --- .../discourse/app/components/input-tip.gjs | 16 ++++++++++ .../discourse/app/components/input-tip.hbs | 4 --- .../discourse/app/components/input-tip.js | 30 ------------------- .../app/components/modal/create-account.hbs | 8 ++--- .../app/components/user-fields/text.hbs | 2 +- .../discourse/app/templates/invites/show.hbs | 8 ++--- 6 files changed, 25 insertions(+), 43 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/components/input-tip.gjs delete mode 100644 app/assets/javascripts/discourse/app/components/input-tip.hbs delete mode 100644 app/assets/javascripts/discourse/app/components/input-tip.js diff --git a/app/assets/javascripts/discourse/app/components/input-tip.gjs b/app/assets/javascripts/discourse/app/components/input-tip.gjs new file mode 100644 index 00000000000..b663ce0f02d --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/input-tip.gjs @@ -0,0 +1,16 @@ +import icon from "discourse-common/helpers/d-icon"; + +const InputTip = ; + +export default InputTip; diff --git a/app/assets/javascripts/discourse/app/components/input-tip.hbs b/app/assets/javascripts/discourse/app/components/input-tip.hbs deleted file mode 100644 index af02c408564..00000000000 --- a/app/assets/javascripts/discourse/app/components/input-tip.hbs +++ /dev/null @@ -1,4 +0,0 @@ -{{#if this.tipReason}} - {{this.tipIcon}} - {{this.tipReason}} -{{/if}} \ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/input-tip.js b/app/assets/javascripts/discourse/app/components/input-tip.js deleted file mode 100644 index 406fff61ffb..00000000000 --- a/app/assets/javascripts/discourse/app/components/input-tip.js +++ /dev/null @@ -1,30 +0,0 @@ -import Component from "@ember/component"; -import { alias, not } from "@ember/object/computed"; -import { htmlSafe } from "@ember/template"; -import { iconHTML } from "discourse-common/lib/icon-library"; - -export default Component.extend({ - classNameBindings: [":tip", "good", "bad"], - tipIcon: null, - tipReason: null, - - bad: alias("validation.failed"), - good: not("bad"), - - tipIconHTML() { - let icon = iconHTML(this.good ? "check" : "times"); - return htmlSafe(`${icon}`); - }, - - didReceiveAttrs() { - this._super(...arguments); - let reason = this.get("validation.reason"); - if (reason) { - this.set("tipIcon", this.tipIconHTML()); - this.set("tipReason", reason); - } else { - this.set("tipIcon", null); - this.set("tipReason", null); - } - }, -}); diff --git a/app/assets/javascripts/discourse/app/components/modal/create-account.hbs b/app/assets/javascripts/discourse/app/components/modal/create-account.hbs index f99c90b10e4..e7fe6850b05 100644 --- a/app/assets/javascripts/discourse/app/components/modal/create-account.hbs +++ b/app/assets/javascripts/discourse/app/components/modal/create-account.hbs @@ -58,7 +58,7 @@ {{i18n "user.email.instructions"}} @@ -84,7 +84,7 @@ {{i18n "user.username.instructions"}} @@ -112,7 +112,7 @@ {{this.nameInstructions}} {{/if}} @@ -152,7 +152,7 @@