mirror of
https://github.com/discourse/discourse.git
synced 2025-02-28 08:19:13 +00:00
FIX: Secondary more section links not marked as active (#17797)
When the route of the link is equal to the active route, we promote it out of the "more..." links drawer and display it directly under the community section. This commit fixes a bug where the secondary links in the "more..." links drawer was not being marked as active. Follow-up to e09fd7cde2d7162d55511ba40b59150ab03c7419
This commit is contained in:
parent
3eaac56797
commit
ad18f7488c
@ -11,6 +11,8 @@ export default class SidebarMoreSectionLinks extends GlimmerComponent {
|
||||
@tracked activeSectionLink;
|
||||
@service router;
|
||||
|
||||
#allLinks = [...this.args.sectionLinks, ...this.args.secondarySectionLinks];
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.#setActiveSectionLink();
|
||||
@ -89,7 +91,7 @@ export default class SidebarMoreSectionLinks extends GlimmerComponent {
|
||||
}
|
||||
|
||||
#setActiveSectionLink() {
|
||||
const activeSectionLink = this.args.sectionLinks.find((sectionLink) => {
|
||||
const activeSectionLink = this.#allLinks.find((sectionLink) => {
|
||||
const args = [sectionLink.route];
|
||||
|
||||
if (sectionLink.model) {
|
||||
|
@ -313,6 +313,11 @@ acceptance("Sidebar - Community Section", function (needs) {
|
||||
"/about",
|
||||
"navigates to about route correctly"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section-community .sidebar-section-link-about.active"),
|
||||
"about section link link is displayed in the main section and marked as active"
|
||||
);
|
||||
});
|
||||
|
||||
test("navigating to FAQ from sidebar", async function (assert) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user