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 %>
|
<% if @navbar_items %>
|
||||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||||
<% @navbar_items.each do |navbar_item| %>
|
<% @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 %>
|
<% 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] %>
|
<% if navbar_item[:icon] %>
|
||||||
<span aria-hidden="true" class="bi-<%= navbar_item[:icon] %>"></span>
|
<span aria-hidden="true" class="bi-<%= navbar_item[:icon] %>"></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= navbar_item[:label] %>
|
<%= navbar_item[:label] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% 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]) %>">
|
<div class="d-md-none">
|
||||||
<% if navbar_item[:icon] %>
|
<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\"" %>
|
||||||
<span aria-hidden="true" class="bi-<%= navbar_item[:icon] %>"></span>
|
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 %>
|
<% end %>
|
||||||
<%= navbar_item[:label] %>
|
</div>
|
||||||
</a>
|
<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 %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="col-auto px-0">
|
<div class="col col-auto px-0 d-none d-md-block">
|
||||||
<div id="sidebar" class="collapse collapse-horizontal show border-0">
|
<div id="sidebar" class="collapse collapse-horizontal show border-0">
|
||||||
<div id="sidebar-nav" class="list-group border-0 rounded-0 text-sm-start" style="min-height: 90vh">
|
<div id="sidebar-nav" class="list-group border-0 rounded-0 text-sm-start" style="min-height: 90vh">
|
||||||
<% if @sidebar_items %>
|
<% if @sidebar_items %>
|
||||||
|
|
@ -19,6 +19,11 @@
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<div class="mt-auto ms-auto me-2">
|
||||||
|
<%= link_to("hide") do %>
|
||||||
|
<span class="bi-chevron-left"></span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="me-auto"></div>
|
<div class="me-auto"></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue