Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-21 17:00:29 +01:00
Add login button when no_access reason is requiresLogin
Dieser Commit ist enthalten in:
Ursprung
cff8f9f427
Commit
54a9e9470e
4 geänderte Dateien mit 30 neuen und 7 gelöschten Zeilen
|
@ -3,6 +3,8 @@ import discourseComputed from "discourse-common/utils/decorators";
|
|||
import Component from "@ember/component";
|
||||
import { dasherize } from "@ember/string";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
import cookie from "discourse/lib/cookie";
|
||||
import { getOwner } from "@ember/application";
|
||||
|
||||
export default Component.extend({
|
||||
classNameBindings: [":wizard-no-access", "reasonClass"],
|
||||
|
@ -17,6 +19,11 @@ export default Component.extend({
|
|||
return this.siteSettings.title || "";
|
||||
},
|
||||
|
||||
@discourseComputed("reason")
|
||||
showLoginButton(reason) {
|
||||
return reason === "requiresLogin";
|
||||
},
|
||||
|
||||
actions: {
|
||||
skip() {
|
||||
if (this.currentUser) {
|
||||
|
@ -25,5 +32,10 @@ export default Component.extend({
|
|||
window.location = getURL("/");
|
||||
}
|
||||
},
|
||||
|
||||
showLogin() {
|
||||
cookie("destination_url", getURL(`/w/${this.get("wizardId")}`));
|
||||
getOwner(this).lookup("route:application").send("showLogin");
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
<div>{{text}}</div>
|
||||
<div class="no-access-gutter">
|
||||
<button
|
||||
class="wizard-btn primary return-to-site"
|
||||
<a
|
||||
class="return-to-site"
|
||||
{{action "skip"}}
|
||||
type="button"
|
||||
>
|
||||
{{i18n "wizard.return_to_site" siteName=siteName}}
|
||||
{{d-icon "sign-out-alt"}}
|
||||
</button>
|
||||
</a>
|
||||
{{#if showLoginButton}}
|
||||
<DButton
|
||||
class="btn-primary btn-small login-button"
|
||||
@action={{action "showLogin"}}
|
||||
@label="log_in"
|
||||
@icon="user"
|
||||
/>
|
||||
{{/if}}
|
||||
</div>
|
|
@ -158,7 +158,12 @@ body.custom-wizard {
|
|||
.no-access-gutter {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
|
||||
.return-to-site {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.powered-by-discourse {
|
||||
|
|
|
@ -5,7 +5,7 @@ en:
|
|||
completed: "You have completed this wizard."
|
||||
not_permitted: "You are not permitted to access this wizard."
|
||||
none: "There is no wizard here."
|
||||
return_to_site: "Return to {{siteName}}"
|
||||
return_to_site: "Return to {{siteName}}."
|
||||
requires_login: "You need to be logged in to access this wizard."
|
||||
reset: "Reset this wizard."
|
||||
step_not_permitted: "You're not permitted to view this step."
|
||||
|
|
Laden …
In neuem Issue referenzieren