parent
044dc85358
commit
ba2c5c7948
|
@ -7,13 +7,15 @@ import { action } from "@ember/object";
|
||||||
const HIDE_SIDEBAR_KEY = "sidebar-hidden";
|
const HIDE_SIDEBAR_KEY = "sidebar-hidden";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
queryParams: ["enable_sidebar"],
|
queryParams: [{ sidebarQueryParamOverride: "enable_sidebar" }],
|
||||||
|
|
||||||
showTop: true,
|
showTop: true,
|
||||||
showFooter: false,
|
showFooter: false,
|
||||||
router: service(),
|
router: service(),
|
||||||
showSidebar: false,
|
showSidebar: false,
|
||||||
enable_sidebar: null,
|
sidebarQueryParamOverride: null,
|
||||||
|
sidebarDisabledRouteOverride: false,
|
||||||
|
showSiteHeader: true,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
@ -62,20 +64,25 @@ export default Controller.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"enable_sidebar",
|
"sidebarQueryParamOverride",
|
||||||
"siteSettings.enable_sidebar",
|
"siteSettings.enable_sidebar",
|
||||||
"router.currentRouteName",
|
"canDisplaySidebar",
|
||||||
"canDisplaySidebar"
|
"sidebarDisabledRouteOverride"
|
||||||
)
|
)
|
||||||
sidebarEnabled(
|
sidebarEnabled(
|
||||||
sidebarQueryParamOverride,
|
sidebarQueryParamOverride,
|
||||||
enableSidebar,
|
enableSidebar,
|
||||||
currentRouteName,
|
canDisplaySidebar,
|
||||||
canDisplaySidebar
|
sidebarDisabledRouteOverride
|
||||||
) {
|
) {
|
||||||
if (!canDisplaySidebar) {
|
if (!canDisplaySidebar) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sidebarDisabledRouteOverride) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (sidebarQueryParamOverride === "1") {
|
if (sidebarQueryParamOverride === "1") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -84,10 +91,6 @@ export default Controller.extend({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentRouteName.startsWith("wizard")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always return dropdown on mobile
|
// Always return dropdown on mobile
|
||||||
if (this.site.mobileView) {
|
if (this.site.mobileView) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -96,11 +99,6 @@ export default Controller.extend({
|
||||||
return enableSidebar;
|
return enableSidebar;
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("router.currentRouteName")
|
|
||||||
showSiteHeader(currentRouteName) {
|
|
||||||
return !currentRouteName.startsWith("wizard");
|
|
||||||
},
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
toggleSidebar() {
|
toggleSidebar() {
|
||||||
// enables CSS transitions, but not on did-insert
|
// enables CSS transitions, but not on did-insert
|
||||||
|
|
|
@ -26,9 +26,22 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
activate() {
|
||||||
|
this.controllerFor("application").setProperties({
|
||||||
|
sidebarDisabledRouteOverride: true,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
deactivate() {
|
||||||
|
this.controllerFor("application").setProperties({
|
||||||
|
sidebarDisabledRouteOverride: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
controller.resetState();
|
controller.resetState();
|
||||||
|
|
||||||
if (model.error) {
|
if (model.error) {
|
||||||
controller.displayError(model.error);
|
controller.displayError(model.error);
|
||||||
controller.set("loadError", true);
|
controller.set("loadError", true);
|
||||||
|
|
|
@ -283,4 +283,13 @@ acceptance("Second Factor Auth Page", function (needs) {
|
||||||
);
|
);
|
||||||
assert.equal(callbackCount, 1, "callback request has been performed");
|
assert.equal(callbackCount, 1, "callback request has been performed");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("sidebar is disabled on 2FA route", async function (assert) {
|
||||||
|
this.siteSettings.enable_experimental_sidebar_hamburger = true;
|
||||||
|
this.siteSettings.enable_sidebar = true;
|
||||||
|
|
||||||
|
await visit("/session/2fa?nonce=ok110111");
|
||||||
|
|
||||||
|
assert.notOk(exists(".sidebar-container"), "does not display the sidebar");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,14 +8,22 @@ export default Route.extend({
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
document.body.classList.add("wizard");
|
document.body.classList.add("wizard");
|
||||||
|
|
||||||
this.controllerFor("application").setProperties({
|
this.controllerFor("application").setProperties({
|
||||||
showTop: false,
|
showTop: false,
|
||||||
showFooter: false,
|
showFooter: false,
|
||||||
|
sidebarDisabledRouteOverride: true,
|
||||||
|
showSiteHeader: false,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
document.body.classList.remove("wizard");
|
document.body.classList.remove("wizard");
|
||||||
this.controllerFor("application").set("showTop", true);
|
|
||||||
|
this.controllerFor("application").setProperties({
|
||||||
|
showTop: true,
|
||||||
|
sidebarDisabledRouteOverride: false,
|
||||||
|
showSiteHeader: true,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue