0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00
Dieser Commit ist enthalten in:
Angus McLeod 2022-09-23 15:54:43 +02:00
Ursprung c79dee3d16
Commit a3db405d93
5 geänderte Dateien mit 27 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -10,7 +10,9 @@ export default Component.extend(Subscription, {
@discourseComputed("subscribed") @discourseComputed("subscribed")
i18nKey(subscribed) { i18nKey(subscribed) {
return `admin.wizard.subscription.cta.${subscribed ? "subscribed" : "none"}`; return `admin.wizard.subscription.cta.${
subscribed ? "subscribed" : "none"
}`;
}, },
@discourseComputed("subscribed") @discourseComputed("subscribed")

Datei anzeigen

@ -28,7 +28,7 @@ export default SingleSelectComponent.extend(Subscription, {
allowedSubscriptionTypes(feature, attribute, value) { allowedSubscriptionTypes(feature, attribute, value) {
let attributes = this.subscriptionAttributes[feature]; let attributes = this.subscriptionAttributes[feature];
if (!attributes || !attributes[attribute]) { if (!attributes || !attributes[attribute]) {
return ['none']; return ["none"];
} }
let allowedTypes = []; let allowedTypes = [];
Object.keys(attributes[attribute]).forEach((subscriptionType) => { Object.keys(attributes[attribute]).forEach((subscriptionType) => {
@ -50,17 +50,20 @@ export default SingleSelectComponent.extend(Subscription, {
value value
); );
let subscriptionRequired = allowedSubscriptionTypes.length && let subscriptionRequired =
!allowedSubscriptionTypes.includes('none'); allowedSubscriptionTypes.length &&
!allowedSubscriptionTypes.includes("none");
let attrs = { let attrs = {
id: value, id: value,
name: I18n.t(nameKey(feature, attribute, value)), name: I18n.t(nameKey(feature, attribute, value)),
subscriptionRequired subscriptionRequired,
}; };
if (subscriptionRequired) { if (subscriptionRequired) {
let subscribed = allowedSubscriptionTypes.includes(this.subscriptionType); let subscribed = allowedSubscriptionTypes.includes(
this.subscriptionType
);
let selectorKey = subscribed ? "subscribed" : "not_subscribed"; let selectorKey = subscribed ? "subscribed" : "not_subscribed";
let selectorLabel = `admin.wizard.subscription.${selectorKey}.selector`; let selectorLabel = `admin.wizard.subscription.${selectorKey}.selector`;

Datei anzeigen

@ -5,5 +5,5 @@ export default Controller.extend({
businessSubscription: equal("subscriptionType", "business"), businessSubscription: equal("subscriptionType", "business"),
communitySubscription: equal("subscriptionType", "community"), communitySubscription: equal("subscriptionType", "community"),
standardSubscription: equal("subscriptionType", "standard"), standardSubscription: equal("subscriptionType", "standard"),
showApi: or('businessSubscription', 'communitySubscription') showApi: or("businessSubscription", "communitySubscription"),
}); });

Datei anzeigen

@ -4,8 +4,10 @@ import { readOnly } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech"; const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
const SUPPORT_MESSAGE = "https://coop.pavilion.tech/new-message?username=support&title=Custom%20Wizard%20Support"; const SUPPORT_MESSAGE =
const MANAGER_CATEGORY = "https://discourse.pluginmanager.org/c/discourse-custom-wizard"; "https://coop.pavilion.tech/new-message?username=support&title=Custom%20Wizard%20Support";
const MANAGER_CATEGORY =
"https://discourse.pluginmanager.org/c/discourse-custom-wizard";
export default Mixin.create({ export default Mixin.create({
subscriptionLandingUrl: PRODUCT_PAGE, subscriptionLandingUrl: PRODUCT_PAGE,
@ -36,11 +38,16 @@ export default Mixin.create({
@discourseComputed("subscriptionType") @discourseComputed("subscriptionType")
subscriptionCtaLink(subscriptionType) { subscriptionCtaLink(subscriptionType) {
switch (subscriptionType) { switch (subscriptionType) {
case "none": return PRODUCT_PAGE; case "none":
case "standard": return SUPPORT_MESSAGE; return PRODUCT_PAGE;
case "business": return SUPPORT_MESSAGE; case "standard":
case "community": return MANAGER_CATEGORY; return SUPPORT_MESSAGE;
default: return PRODUCT_PAGE; case "business":
return SUPPORT_MESSAGE;
case "community":
return MANAGER_CATEGORY;
default:
return PRODUCT_PAGE;
} }
}, },
}); });

Datei anzeigen

@ -69,7 +69,7 @@ body.custom-wizard {
} }
& > .field-label + .field-description { & > .field-label + .field-description {
margin-left: .5em; margin-left: 0.5em;
} }
} }