docbrown/app/views/admin/shared/_nested_sidebar.html.erb
Ridhwana cf5207564f
RFC#50-P5 Prepares the admin restructure to be tested (#13114)
* feat: make the sidebar more dynamic

* refactor: use the action in the same controller instead of the whole path

* feat: remove hardcoded routes

* feat: move routes into file

* feat: use rails 6 draw for the admin routes

* add a helper method

* oops: fix super

* feat: add the hacky helper methods :( )

* WIP: created different path helpers for the new routes and point the old helpers to the new ones if the FF is toggled

* feat: update the module

* chore: add new paths

* feat: change link_to's use paths instead

* feat: feedback_messages to scoped admin route

* chore: update the feature flag urls helpers

* feat: feedback_messages issue

* chore: remove all the workarounds

* chore: rubucop

* fix: oops remove helper

* chore: comment out the tests that touch the tabbed navbar which is affected by the rails application needing to be reloaded

* feat: ensure that we chcek if the db table exists
2021-04-15 14:53:46 +02:00

42 lines
2.1 KiB
Text

<% menu_items.each do |group_name, group| %>
<li>
<% if group[:children].length == 1 %>
<% if group[:children][0][:visible] %>
<a class="crayons-link crayons-link--block <%= "crayons-link--current" if deduced_scope(request) == group[:children][0][:controller] %>"
href="/admin/<%= group[:children][0][:controller] %>"
aria-page="<%= "page" if deduced_controller(request) == group[:children][0][:controller] %>"
data-action="click->sidebar#expandDropdown">
<%= inline_svg_tag(group[:svg], aria: true, class: "dropdown-icon crayons-icon") %>
<%= display_name(group_name) %>
</a>
<% end %>
<% else %>
<button class="crayons-link crayons-link--block cursor-pointer <%= "crayons-link--current" if deduced_scope(request) == group_name.to_s %>"
id="<%= group_name %>_button"
data-toggle="collapse"
data-target="#<%= group_name %>"
data-target-href="/admin/<%= group_name %>/<%= group[:children][0][:controller] %>"
aria-expanded="<%= (deduced_scope(request) == group_name.to_s).to_s %>"
aria-controls="<%= group_name %>"
data-action="click->sidebar#expandDropdown">
<%= inline_svg_tag(group[:svg], aria: true, class: "dropdown-icon crayons-icon") %>
<%= display_name(group_name) %>
</button>
<ul id="<%= group_name %>"
data-sidebar-target="submenu"
class="<%= deduced_scope(request) == group_name.to_s ? "expand show" : "collapse hide" %>">
<% group[:children].each do |item| %>
<% if item[:visible] %>
<li>
<a class="crayons-link crayons-link--block ml-7 <%= "fw-bold" if deduced_controller(request) == item[:controller].to_s %>"
href="/admin/<%= group_name %>/<%= item[:controller] %>"
aria-page="<%= "page" if deduced_controller(request) == item[:controller].to_s %>">
<%= item[:name].to_s.titleize %>
</a>
</li>
<% end %>
<% end %>
</ul>
<% end %>
</li>
<% end %>