2022-07-27 12:47:50 +02:00
|
|
|
import CustomWizard from "../models/custom-wizard";
|
2022-03-16 12:33:34 +01:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
|
|
import Component from "@ember/component";
|
|
|
|
import { dasherize } from "@ember/string";
|
2022-08-24 09:52:08 +02:00
|
|
|
import getURL from "discourse-common/lib/get-url";
|
2024-07-09 11:24:40 +02:00
|
|
|
import cookie from "discourse/lib/cookie";
|
|
|
|
import { getOwner } from "@ember/application";
|
2018-05-09 07:06:43 +02:00
|
|
|
|
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
|
|
|
},
|
2018-05-09 07:06:43 +02:00
|
|
|
|
2024-07-09 11:24:40 +02:00
|
|
|
@discourseComputed("reason")
|
|
|
|
showLoginButton(reason) {
|
|
|
|
return reason === "requiresLogin";
|
|
|
|
},
|
|
|
|
|
2018-05-09 07:06:43 +02:00
|
|
|
actions: {
|
|
|
|
skip() {
|
2022-08-24 09:52:08 +02:00
|
|
|
if (this.currentUser) {
|
|
|
|
CustomWizard.skip(this.get("wizardId"));
|
|
|
|
} else {
|
|
|
|
window.location = getURL("/");
|
|
|
|
}
|
2021-03-28 11:06:49 +02:00
|
|
|
},
|
2024-07-09 11:24:40 +02:00
|
|
|
|
|
|
|
showLogin() {
|
|
|
|
cookie("destination_url", getURL(`/w/${this.get("wizardId")}`));
|
|
|
|
getOwner(this).lookup("route:application").send("showLogin");
|
2024-07-09 11:26:34 +02:00
|
|
|
},
|
2021-03-28 11:06:49 +02:00
|
|
|
},
|
2019-06-19 07:39:39 +02:00
|
|
|
});
|