Require usage of controller path in nav_link

Description

We use nav_link helper to determine if navigation tab should be highlighted or not.

nav_link helper uses controller_name and controller_path under the hood, and this may result in arbitrary matches.

Example: nav_link(controller: [:repositories]) can match both projects/repositories and projects/registry/repositories). In the past we had similar problem with projects/pipelines and projects/settings/pipelines.

Using more modular approach inside app/controllers is something that will be difficult to avoid (and this is OK to use modules there).

Proposal

Require passing full path to controller to nav_link only.

Links / references

https://gitlab.com/gitlab-org/gitlab-ce/issues/31027

What do you think about it @rymai @rspeicher?

Edited Sep 26, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading