From e43fbd0b50caa7bfd336e377615892648e3d4c39 Mon Sep 17 00:00:00 2001 From: merefield Date: Sun, 24 Sep 2023 10:01:08 +0100 Subject: [PATCH] move subscription container to Glimmer --- .../wizard-subscription-container.hbs | 14 ++++++++++ .../wizard-subscription-container.js | 26 ++++++++++++++++++ .../wizard-subscription-container.js.es6 | 27 ------------------- .../wizard-subscription-container.hbs | 12 --------- 4 files changed, 40 insertions(+), 39 deletions(-) create mode 100644 assets/javascripts/discourse/components/wizard-subscription-container.hbs create mode 100644 assets/javascripts/discourse/components/wizard-subscription-container.js delete mode 100644 assets/javascripts/discourse/components/wizard-subscription-container.js.es6 delete mode 100644 assets/javascripts/discourse/templates/components/wizard-subscription-container.hbs diff --git a/assets/javascripts/discourse/components/wizard-subscription-container.hbs b/assets/javascripts/discourse/components/wizard-subscription-container.hbs new file mode 100644 index 00000000..044b57f6 --- /dev/null +++ b/assets/javascripts/discourse/components/wizard-subscription-container.hbs @@ -0,0 +1,14 @@ +
+
+

{{i18n "admin.wizard.subscription.title"}}

+ + + {{d-icon subscribedIcon}} + {{i18n subscribedLabel}} + +
+ +
+ {{yield}} +
+
\ No newline at end of file diff --git a/assets/javascripts/discourse/components/wizard-subscription-container.js b/assets/javascripts/discourse/components/wizard-subscription-container.js new file mode 100644 index 00000000..25cb3973 --- /dev/null +++ b/assets/javascripts/discourse/components/wizard-subscription-container.js @@ -0,0 +1,26 @@ +import Component from '@glimmer/component'; +import { computed } from "@ember/object"; +import { inject as service } from "@ember/service"; + +export default class WizardSubscriptionContainer extends Component { + @service subscription; + + @computed("subscription.subscribed") + get subscribedIcon() { + return this.subscription.subscribed ? "check" : "times"; + }; + + @computed("subscription.subscribed") + get subscribedLabel() { + return `admin.wizard.subscription.${ + this.subscription.subscribed ? "subscribed" : "not_subscribed" + }.label`; + }; + + @computed("subscription.subscribed") + get subscribedTitle() { + return `admin.wizard.subscription.${ + this.subscription.subscribed ? "subscribed" : "not_subscribed" + }.title`; + }; +}; diff --git a/assets/javascripts/discourse/components/wizard-subscription-container.js.es6 b/assets/javascripts/discourse/components/wizard-subscription-container.js.es6 deleted file mode 100644 index 8c750519..00000000 --- a/assets/javascripts/discourse/components/wizard-subscription-container.js.es6 +++ /dev/null @@ -1,27 +0,0 @@ -import Component from "@ember/component"; -import discourseComputed from "discourse-common/utils/decorators"; -import { inject as service } from "@ember/service"; - -export default Component.extend({ - classNameBindings: [":wizard-subscription-container", "subscribed"], - subscription: service(), - - @discourseComputed("subscription.subscribed") - subscribedIcon(subscribed) { - return subscribed ? "check" : "times"; - }, - - @discourseComputed("subscription.subscribed") - subscribedLabel(subscribed) { - return `admin.wizard.subscription.${ - subscribed ? "subscribed" : "not_subscribed" - }.label`; - }, - - @discourseComputed("subscription.subscribed") - subscribedTitle(subscribed) { - return `admin.wizard.subscription.${ - subscribed ? "subscribed" : "not_subscribed" - }.title`; - }, -}); diff --git a/assets/javascripts/discourse/templates/components/wizard-subscription-container.hbs b/assets/javascripts/discourse/templates/components/wizard-subscription-container.hbs deleted file mode 100644 index b8031bfe..00000000 --- a/assets/javascripts/discourse/templates/components/wizard-subscription-container.hbs +++ /dev/null @@ -1,12 +0,0 @@ -
-

{{i18n "admin.wizard.subscription.title"}}

- - - {{d-icon subscribedIcon}} - {{i18n subscribedLabel}} - -
- -
- {{yield}} -
\ No newline at end of file