UX: Hide sidebar on invites page (#22125)

This hides the sidebar to make the signup experience less confusing.

Co-authored-by: Ella E <ella.estigoy@gmail.com>
This commit is contained in:
Alan Guo Xiang Tan 2023-06-15 12:01:04 +08:00 committed by GitHub
parent fcaefc9f2f
commit 1bbb41a901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 17 deletions

View File

@ -0,0 +1,15 @@
import Mixin from "@ember/object/mixin";
export default Mixin.create({
activate() {
this.controllerFor("application").setProperties({
sidebarDisabledRouteOverride: true,
});
},
deactivate() {
this.controllerFor("application").setProperties({
sidebarDisabledRouteOverride: false,
});
},
});

View File

@ -2,8 +2,9 @@ import DiscourseRoute from "discourse/routes/discourse";
import I18n from "I18n";
import PreloadStore from "discourse/lib/preload-store";
import { deepMerge } from "discourse-common/lib/object";
import DisableSidebar from "discourse/mixins/disable-sidebar";
export default DiscourseRoute.extend({
export default DiscourseRoute.extend(DisableSidebar, {
titleToken() {
return I18n.t("invites.accept_title");
},

View File

@ -2,8 +2,9 @@ import DiscourseRoute from "discourse/routes/discourse";
import PreloadStore from "discourse/lib/preload-store";
import { ajax } from "discourse/lib/ajax";
import { extractError } from "discourse/lib/ajax-error";
import DisableSidebar from "discourse/mixins/disable-sidebar";
export default DiscourseRoute.extend({
export default DiscourseRoute.extend(DisableSidebar, {
queryParams: {
nonce: { refreshModel: true },
},
@ -26,18 +27,6 @@ export default DiscourseRoute.extend({
}
},
activate() {
this.controllerFor("application").setProperties({
sidebarDisabledRouteOverride: true,
});
},
deactivate() {
this.controllerFor("application").setProperties({
sidebarDisabledRouteOverride: false,
});
},
setupController(controller, model) {
this._super(...arguments);
controller.resetState();

View File

@ -97,6 +97,12 @@ acceptance("Invite accept", function (needs) {
});
await visit("/invites/my-valid-invite-token");
assert.notOk(
document.body.classList.contains("has-sidebar-page"),
"does not display the sidebar on the invites page"
);
assert.ok(exists("#new-account-email"), "shows the email input");
assert.ok(exists("#new-account-username"), "shows the username input");
assert.strictEqual(

View File

@ -1,28 +1,31 @@
import Route from "@ember/routing/route";
import { findWizard } from "wizard/models/wizard";
import DisableSidebar from "discourse/mixins/disable-sidebar";
export default Route.extend({
export default Route.extend(DisableSidebar, {
model() {
return findWizard();
},
activate() {
this._super(...arguments);
document.body.classList.add("wizard");
this.controllerFor("application").setProperties({
showTop: false,
showFooter: false,
sidebarDisabledRouteOverride: true,
showSiteHeader: false,
});
},
deactivate() {
this._super(...arguments);
document.body.classList.remove("wizard");
this.controllerFor("application").setProperties({
showTop: true,
sidebarDisabledRouteOverride: false,
showSiteHeader: true,
});
},