Stupid fix für mobile menu -> offcanvas sidebar
This commit is contained in:
parent
b4cfad65c0
commit
42e6efc2a3
2 changed files with 40 additions and 8 deletions
|
|
@ -11,21 +11,48 @@
|
|||
<% if @navbar_items %>
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<% @navbar_items.each do |navbar_item| %>
|
||||
<li class="nav-item">
|
||||
<% dropdown = (navbar_item[:active] || @nav_path.to_s == navbar_item[:path].to_s) && @sidebar_items.any? %>
|
||||
<li class="nav-item<%= " dropdown" if dropdown %>">
|
||||
<% if navbar_item[:method].present? && navbar_item[:method] != :get %>
|
||||
<%= button_to(navbar_item[:path], method: navbar_item[:method], class: "nav-link") do %>
|
||||
<%= button_to(navbar_item[:path], method: navbar_item[:method], class: "nav-link#{" dropdown-toggle" if dropdown }") do %>
|
||||
<% if navbar_item[:icon] %>
|
||||
<span aria-hidden="true" class="bi-<%= navbar_item[:icon] %>"></span>
|
||||
<% end %>
|
||||
<%= navbar_item[:label] %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<a class="nav-link <%= (navbar_item[:active] || @nav_path.to_s == navbar_item[:path].to_s) && "active" %>" <%= @nav_path.to_s == navbar_item[:path].to_s && "aria-current=\"page\"" %> href="<%= url_for(navbar_item[:path]) %>">
|
||||
<% if navbar_item[:icon] %>
|
||||
<span aria-hidden="true" class="bi-<%= navbar_item[:icon] %>"></span>
|
||||
<div class="d-md-none">
|
||||
<a class="nav-link <%= (navbar_item[:active] || @nav_path.to_s == navbar_item[:path].to_s) && "active#{"" if dropdown }" %>" <%= @nav_path.to_s == navbar_item[:path].to_s && "aria-current=\"page\"" %>
|
||||
href="<%= dropdown ? "#" : url_for(navbar_item[:path]) %>" <%= dropdown ? 'role="button" data-bs-toggle="dropdown" aria-expanded="false"' : "" %>>
|
||||
<% if navbar_item[:icon] %>
|
||||
<span aria-hidden="true" class="bi-<%= navbar_item[:icon] %>"></span>
|
||||
<% end %>
|
||||
<%= navbar_item[:label] %>
|
||||
</a>
|
||||
<% if dropdown %>
|
||||
<ul class="">
|
||||
<% @sidebar_items.each do |sidebar_item| %>
|
||||
<li class="dropdown-item">
|
||||
<a class="nav-link text-truncate <%= ((sidebar_item[:active] || @nav_path.to_s == sidebar_item[:path].to_s) && "active") || "" %>" <%= @nav_path.to_s == sidebar_item[:path].to_s && "aria-current=\"page\"" || "" %> href="<%= url_for(sidebar_item[:path]) %>">
|
||||
<% if sidebar_item[:icon] %>
|
||||
<span aria-hidden="true" class="bi-<%= sidebar_item[:icon] %>"></span>
|
||||
<% end %>
|
||||
<%= sidebar_item[:label] %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<%= navbar_item[:label] %>
|
||||
</a>
|
||||
</div>
|
||||
<div class="d-none d-md-block">
|
||||
<a class="nav-link <%= (navbar_item[:active] || @nav_path.to_s == navbar_item[:path].to_s) && "active" || "" %>" <%= @nav_path.to_s == navbar_item[:path].to_s && "aria-current=\"page\"" || "" %>
|
||||
href="<%= url_for(navbar_item[:path]) %>">
|
||||
<% if navbar_item[:icon] %>
|
||||
<span aria-hidden="true" class="bi-<%= navbar_item[:icon] %>"></span>
|
||||
<% end %>
|
||||
<%= navbar_item[:label] %>
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue