Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20: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";
|
return this.connector === "is";
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@discourseComputed("site.groups", "guestGroup", "subscription.subscriptionType")
|
@discourseComputed(
|
||||||
|
"site.groups",
|
||||||
|
"guestGroup",
|
||||||
|
"subscription.subscriptionType"
|
||||||
|
)
|
||||||
groups(groups, guestGroup, subscriptionType) {
|
groups(groups, guestGroup, subscriptionType) {
|
||||||
let result = groups;
|
let result = groups;
|
||||||
if (!guestGroup) {
|
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
|
<svg
|
||||||
width="300px"
|
width="300px"
|
||||||
height="300px"
|
height="300px"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
import { action, computed } from "@ember/object";
|
import { action, computed } from "@ember/object";
|
||||||
import Component from '@glimmer/component';
|
import Component from "@glimmer/component";
|
||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
||||||
|
@ -9,21 +9,25 @@ export default class WizardSubscriptionBadge extends Component {
|
||||||
|
|
||||||
@computed("subscription.subscriptionType")
|
@computed("subscription.subscriptionType")
|
||||||
get i18nKey() {
|
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")
|
@computed("i18nKey")
|
||||||
get title() {
|
get title() {
|
||||||
return I18n.t(`${this.i18nKey}.title`);
|
return I18n.t(`${this.i18nKey}.title`);
|
||||||
};
|
}
|
||||||
|
|
||||||
@computed("i18nKey")
|
@computed("i18nKey")
|
||||||
get label() {
|
get label() {
|
||||||
return I18n.t(`${this.i18nKey}.label`);
|
return I18n.t(`${this.i18nKey}.label`);
|
||||||
};
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
click() {
|
click() {
|
||||||
DiscourseURL.routeTo(this.subscription.subscriptionLink);
|
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">
|
<div class="subscription-header">
|
||||||
<h4>{{i18n "admin.wizard.subscription.title"}}</h4>
|
<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 { computed } from "@ember/object";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
|
@ -8,19 +8,19 @@ export default class WizardSubscriptionContainer extends Component {
|
||||||
@computed("subscription.subscribed")
|
@computed("subscription.subscribed")
|
||||||
get subscribedIcon() {
|
get subscribedIcon() {
|
||||||
return this.subscription.subscribed ? "check" : "times";
|
return this.subscription.subscribed ? "check" : "times";
|
||||||
};
|
}
|
||||||
|
|
||||||
@computed("subscription.subscribed")
|
@computed("subscription.subscribed")
|
||||||
get subscribedLabel() {
|
get subscribedLabel() {
|
||||||
return `admin.wizard.subscription.${
|
return `admin.wizard.subscription.${
|
||||||
this.subscription.subscribed ? "subscribed" : "not_subscribed"
|
this.subscription.subscribed ? "subscribed" : "not_subscribed"
|
||||||
}.label`;
|
}.label`;
|
||||||
};
|
}
|
||||||
|
|
||||||
@computed("subscription.subscribed")
|
@computed("subscription.subscribed")
|
||||||
get subscribedTitle() {
|
get subscribedTitle() {
|
||||||
return `admin.wizard.subscription.${
|
return `admin.wizard.subscription.${
|
||||||
this.subscription.subscribed ? "subscribed" : "not_subscribed"
|
this.subscription.subscribed ? "subscribed" : "not_subscribed"
|
||||||
}.title`;
|
}.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}}
|
{{d-icon icon}}{{label}}
|
||||||
</a>
|
</a>
|
|
@ -1,8 +1,7 @@
|
||||||
|
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
import { action, computed } from "@ember/object";
|
import { action, computed } from "@ember/object";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import Component from '@glimmer/component';
|
import Component from "@glimmer/component";
|
||||||
|
|
||||||
export default class WizardSubscriptionCta extends Component {
|
export default class WizardSubscriptionCta extends Component {
|
||||||
@service subscription;
|
@service subscription;
|
||||||
|
@ -12,25 +11,25 @@ export default class WizardSubscriptionCta extends Component {
|
||||||
return `admin.wizard.subscription.cta.${
|
return `admin.wizard.subscription.cta.${
|
||||||
this.subscription.subscribed ? "subscribed" : "none"
|
this.subscription.subscribed ? "subscribed" : "none"
|
||||||
}`;
|
}`;
|
||||||
};
|
}
|
||||||
|
|
||||||
@computed("subscription.subscribed")
|
@computed("subscription.subscribed")
|
||||||
get icon() {
|
get icon() {
|
||||||
return this.subscription.subscribed ? "far-life-ring" : "external-link-alt";
|
return this.subscription.subscribed ? "far-life-ring" : "external-link-alt";
|
||||||
};
|
}
|
||||||
|
|
||||||
@computed("i18nKey")
|
@computed("i18nKey")
|
||||||
get title() {
|
get title() {
|
||||||
return I18n.t(`${this.i18nKey}.title`);
|
return I18n.t(`${this.i18nKey}.title`);
|
||||||
};
|
}
|
||||||
|
|
||||||
@computed("i18nKey")
|
@computed("i18nKey")
|
||||||
get label() {
|
get label() {
|
||||||
return I18n.t(`${this.i18nKey}.label`);
|
return I18n.t(`${this.i18nKey}.label`);
|
||||||
};
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
click() {
|
click() {
|
||||||
window.open(this.subscription.subscriptionCtaLink, "_blank").focus();
|
window.open(this.subscription.subscriptionCtaLink, "_blank").focus();
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ export default class WizardSubscriptionStatus extends Component {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
ajax(`${this.basePath}`).then((result) => {
|
ajax(`${this.basePath}`)
|
||||||
|
.then((result) => {
|
||||||
this.supplierId = result.suppliers[0].id;
|
this.supplierId = result.suppliers[0].id;
|
||||||
this.authorized = result.suppliers[0].authorized;
|
this.authorized = result.suppliers[0].authorized;
|
||||||
})
|
})
|
||||||
|
|
|
@ -10,7 +10,7 @@ export default DiscourseRoute.extend({
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
subscribed: model.subscribed,
|
subscribed: model.subscribed,
|
||||||
subscriptionType: model.subscription_type,
|
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 { getOwner } from "discourse-common/lib/get-owner";
|
||||||
import { tracked } from "@glimmer/tracking";
|
import { tracked } from "@glimmer/tracking";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
@ -26,7 +26,8 @@ export default class SubscriptionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
retrieveSubscriptionStatus() {
|
retrieveSubscriptionStatus() {
|
||||||
ajax("/admin/wizards/subscription").then(result => {
|
ajax("/admin/wizards/subscription")
|
||||||
|
.then((result) => {
|
||||||
this.subscribed = result.subscribed;
|
this.subscribed = result.subscribed;
|
||||||
this.subscriptionType = result.subscription_type;
|
this.subscriptionType = result.subscription_type;
|
||||||
this.subscriptionAttributes = result.subscription_attributes;
|
this.subscriptionAttributes = result.subscription_attributes;
|
||||||
|
@ -35,15 +36,15 @@ export default class SubscriptionService extends Service {
|
||||||
this.standardSubscription = equal(this.subscriptionType, "standard");
|
this.standardSubscription = equal(this.subscriptionType, "standard");
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
};
|
}
|
||||||
|
|
||||||
get adminWizards() {
|
get adminWizards() {
|
||||||
return getOwner(this).lookup("controller:admin-wizards");
|
return getOwner(this).lookup("controller:admin-wizards");
|
||||||
};
|
}
|
||||||
|
|
||||||
get subscriptionLink() {
|
get subscriptionLink() {
|
||||||
return this.subscriptionLandingUrl;
|
return this.subscriptionLandingUrl;
|
||||||
};
|
}
|
||||||
|
|
||||||
get subscriptionCtaLink() {
|
get subscriptionCtaLink() {
|
||||||
switch (this.subscriptionType) {
|
switch (this.subscriptionType) {
|
||||||
|
@ -58,5 +59,5 @@ export default class SubscriptionService extends Service {
|
||||||
default:
|
default:
|
||||||
return PRODUCT_PAGE;
|
return PRODUCT_PAGE;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
Laden …
In neuem Issue referenzieren