0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-24 10:20:28 +01:00
discourse-custom-wizard/assets/javascripts/discourse/components/custom-wizard-no-access.js

42 Zeilen
1 KiB
JavaScript

2024-11-22 17:11:51 +01:00
import { getOwner } from "@ember/application";
2022-03-16 12:33:34 +01:00
import Component from "@ember/component";
import { dasherize } from "@ember/string";
import cookie from "discourse/lib/cookie";
2024-11-22 17:11:51 +01:00
import getURL from "discourse-common/lib/get-url";
import discourseComputed from "discourse-common/utils/decorators";
import CustomWizard from "../models/custom-wizard";
2022-03-16 12:33:34 +01:00
export default Component.extend({
2022-06-15 08:59:09 +02:00
classNameBindings: [":wizard-no-access", "reasonClass"],
2022-03-16 12:33:34 +01:00
2022-06-15 08:59:09 +02:00
@discourseComputed("reason")
2022-03-16 12:33:34 +01:00
reasonClass(reason) {
return dasherize(reason);
},
@discourseComputed
siteName() {
2022-06-15 08:59:09 +02:00
return this.siteSettings.title || "";
2022-03-16 12:33:34 +01:00
},
@discourseComputed("reason")
showLoginButton(reason) {
return reason === "requiresLogin";
},
actions: {
skip() {
if (this.currentUser) {
CustomWizard.skip(this.get("wizardId"));
} else {
window.location = getURL("/");
}
},
showLogin() {
cookie("destination_url", getURL(`/w/${this.get("wizardId")}`));
getOwner(this).lookup("route:application").send("showLogin");
2024-07-09 11:26:34 +02:00
},
},
2019-06-19 07:39:39 +02:00
});