Allow specifying navigation menu in views

This commit is contained in:
cryptogopher 2023-05-01 19:27:40 +02:00
parent 9877f061e7
commit 81c13cecf4
2 changed files with 13 additions and 8 deletions

View File

@ -70,4 +70,15 @@ module ApplicationHelper
tag.use href: image_path(source + ".svg") + "#icon"
end
end
def navigation_menu
#menu_items = {right: [[:users, :index],]}
content_tag :div, class: "right" do
if current_user.at_least(:admin)
image_link_to t('.users'), "account-multiple-outline", users_path, class: "tab-button",
current: :active
end
end
end
end

View File

@ -31,15 +31,9 @@
<% end %>
</div>
<%# Allow overwriting/clearing navigation menu for some views %>
<div class="nav-menu">
<% if user_signed_in? %>
<div class="right">
<% if current_user_at_least(:admin) %>
<%= image_link_to t('.users'), "account-multiple-outline", users_path,
current: :active %>
<% end %>
</div>
<% end %>
<%= content_for(:navigation) || (navigation_menu if user_signed_in?) %>
</div>
<%= yield %>