0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 01:10:28 +01:00
Dieser Commit ist enthalten in:
merefield 2023-09-24 11:58:20 +01:00
Ursprung 73e8b0a7fc
Commit d5bd3c3c47
10 geänderte Dateien mit 88 neuen und 68 gelöschten Zeilen

Datei anzeigen

@ -131,7 +131,11 @@ export default Component.extend({
return this.connector === "is";
}),
@discourseComputed("site.groups", "guestGroup", "subscription.subscriptionType")
@discourseComputed(
"site.groups",
"guestGroup",
"subscription.subscriptionType"
)
groups(groups, guestGroup, subscriptionType) {
let result = groups;
if (!guestGroup) {

Datei anzeigen

@ -1,4 +1,8 @@
<a onclick={{this.click}} class="wizard-subscription-badge {{this.subscription.subscriptionType}}" title="{{this.title}}">
<a
onclick={{this.click}}
class="wizard-subscription-badge {{this.subscription.subscriptionType}}"
title="{{this.title}}"
>
<svg
width="300px"
height="300px"

Datei anzeigen

@ -1,6 +1,6 @@
import { inject as service } from "@ember/service";
import { action, computed } from "@ember/object";
import Component from '@glimmer/component';
import Component from "@glimmer/component";
import DiscourseURL from "discourse/lib/url";
import I18n from "I18n";
@ -9,21 +9,25 @@ export default class WizardSubscriptionBadge extends Component {
@computed("subscription.subscriptionType")
get i18nKey() {
return `admin.wizard.subscription.type.${this.subscription.subscriptionType ? this.subscription.subscriptionType : "none"}`;
};
return `admin.wizard.subscription.type.${
this.subscription.subscriptionType
? this.subscription.subscriptionType
: "none"
}`;
}
@computed("i18nKey")
get title() {
return I18n.t(`${this.i18nKey}.title`);
};
}
@computed("i18nKey")
get label() {
return I18n.t(`${this.i18nKey}.label`);
};
}
@action
click() {
DiscourseURL.routeTo(this.subscription.subscriptionLink);
};
};
}
}

Datei anzeigen

@ -1,4 +1,7 @@
<div class="wizard-subscription-container {{if this.subscription.subscribed "subscribed"}}">
<div
class="wizard-subscription-container
{{if this.subscription.subscribed 'subscribed'}}"
>
<div class="subscription-header">
<h4>{{i18n "admin.wizard.subscription.title"}}</h4>

Datei anzeigen

@ -1,4 +1,4 @@
import Component from '@glimmer/component';
import Component from "@glimmer/component";
import { computed } from "@ember/object";
import { inject as service } from "@ember/service";
@ -8,19 +8,19 @@ export default class WizardSubscriptionContainer extends Component {
@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`;
};
};
}
}

Datei anzeigen

@ -1,3 +1,7 @@
<a onclick={{this.click}} class="btn btn-pavilion-support {{this.subscription.subscriptionType}}" title="{{this.title}}">
<a
onclick={{this.click}}
class="btn btn-pavilion-support {{this.subscription.subscriptionType}}"
title="{{this.title}}"
>
{{d-icon icon}}{{label}}
</a>

Datei anzeigen

@ -1,8 +1,7 @@
import { inject as service } from "@ember/service";
import { action, computed } from "@ember/object";
import I18n from "I18n";
import Component from '@glimmer/component';
import Component from "@glimmer/component";
export default class WizardSubscriptionCta extends Component {
@service subscription;
@ -12,25 +11,25 @@ export default class WizardSubscriptionCta extends Component {
return `admin.wizard.subscription.cta.${
this.subscription.subscribed ? "subscribed" : "none"
}`;
};
}
@computed("subscription.subscribed")
get icon() {
return this.subscription.subscribed ? "far-life-ring" : "external-link-alt";
};
}
@computed("i18nKey")
get title() {
return I18n.t(`${this.i18nKey}.title`);
};
}
@computed("i18nKey")
get label() {
return I18n.t(`${this.i18nKey}.label`);
};
}
@action
click() {
window.open(this.subscription.subscriptionCtaLink, "_blank").focus();
};
};
}
}

Datei anzeigen

@ -15,13 +15,14 @@ export default class WizardSubscriptionStatus extends Component {
constructor() {
super(...arguments);
ajax(`${this.basePath}`).then((result) => {
this.supplierId = result.suppliers[0].id;
this.authorized = result.suppliers[0].authorized;
})
.finally(() => {
this.subscription.retrieveSubscriptionStatus();
});
ajax(`${this.basePath}`)
.then((result) => {
this.supplierId = result.suppliers[0].id;
this.authorized = result.suppliers[0].authorized;
})
.finally(() => {
this.subscription.retrieveSubscriptionStatus();
});
}
@action

Datei anzeigen

@ -10,7 +10,7 @@ export default DiscourseRoute.extend({
controller.setProperties({
subscribed: model.subscribed,
subscriptionType: model.subscription_type,
subscriptionAttributes: model.subscription_attributes
subscriptionAttributes: model.subscription_attributes,
});
},

Datei anzeigen

@ -1,4 +1,4 @@
import Service from '@ember/service';
import Service from "@ember/service";
import { getOwner } from "discourse-common/lib/get-owner";
import { tracked } from "@glimmer/tracking";
import { ajax } from "discourse/lib/ajax";
@ -12,21 +12,22 @@ const MANAGER_CATEGORY =
"https://discourse.pluginmanager.org/c/discourse-custom-wizard";
export default class SubscriptionService extends Service {
@tracked subscribed = false;
@tracked subscriptionType = "";
@tracked businessSubscription = false;
@tracked communitySubscription = false;
@tracked standardSubscription = false;
@tracked subscriptionAttributes = {};
subscriptionLandingUrl = PRODUCT_PAGE;
@tracked subscribed = false;
@tracked subscriptionType = "";
@tracked businessSubscription = false;
@tracked communitySubscription = false;
@tracked standardSubscription = false;
@tracked subscriptionAttributes = {};
subscriptionLandingUrl = PRODUCT_PAGE;
init() {
super.init(...arguments);
this.retrieveSubscriptionStatus();
}
init() {
super.init(...arguments);
this.retrieveSubscriptionStatus();
}
retrieveSubscriptionStatus() {
ajax("/admin/wizards/subscription").then(result => {
retrieveSubscriptionStatus() {
ajax("/admin/wizards/subscription")
.then((result) => {
this.subscribed = result.subscribed;
this.subscriptionType = result.subscription_type;
this.subscriptionAttributes = result.subscription_attributes;
@ -35,28 +36,28 @@ export default class SubscriptionService extends Service {
this.standardSubscription = equal(this.subscriptionType, "standard");
})
.catch(popupAjaxError);
};
}
get adminWizards() {
return getOwner(this).lookup("controller:admin-wizards");
};
get adminWizards() {
return getOwner(this).lookup("controller:admin-wizards");
}
get subscriptionLink() {
return this.subscriptionLandingUrl;
};
get subscriptionLink() {
return this.subscriptionLandingUrl;
}
get subscriptionCtaLink() {
switch (this.subscriptionType) {
case "none":
return PRODUCT_PAGE;
case "standard":
return SUPPORT_MESSAGE;
case "business":
return SUPPORT_MESSAGE;
case "community":
return MANAGER_CATEGORY;
default:
return PRODUCT_PAGE;
}
};
}
get subscriptionCtaLink() {
switch (this.subscriptionType) {
case "none":
return PRODUCT_PAGE;
case "standard":
return SUPPORT_MESSAGE;
case "business":
return SUPPORT_MESSAGE;
case "community":
return MANAGER_CATEGORY;
default:
return PRODUCT_PAGE;
}
}
}