fix: use verified routes in navbar and improve can_access_page?
Use ~p verified routes instead of string paths in navbar template. Update can_access_page? to handle both string and verified route paths for better type safety.
This commit is contained in:
parent
ad0a3cd458
commit
34afe798ec
2 changed files with 8 additions and 4 deletions
|
|
@ -34,9 +34,9 @@ defmodule MvWeb.Layouts.Navbar do
|
|||
<li>
|
||||
<.link navigate="/settings">{gettext("Global Settings")}</.link>
|
||||
</li>
|
||||
<%= if can_access_page?(@current_user, "/admin/roles") do %>
|
||||
<%= if can_access_page?(@current_user, ~p"/admin/roles") do %>
|
||||
<li>
|
||||
<.link navigate="/admin/roles">{gettext("Roles")}</.link>
|
||||
<.link navigate={~p"/admin/roles"}>{gettext("Roles")}</.link>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue