Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-21 17:00:29 +01:00
prettier
Dieser Commit ist enthalten in:
Ursprung
73e8b0a7fc
Commit
d5bd3c3c47
10 geänderte Dateien mit 88 neuen und 68 gelöschten Zeilen
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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`;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -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();
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Laden …
In neuem Issue referenzieren