docbrown/app/views/layouts/_main_nav.html.erb
Julien Maury 01c1d44e65
Fix duplicate IDs on homepage (#17092)
* fix duplicate ID main nav

* fix duplicate ID other nav headings

* fix duplicate ID reading list count

* fix duplicate attribute class

* missing case readingCountList on feed

* missing dot in query selector

* Revert "fix duplicate ID other nav headings"

This reverts commit 4f495962c47e08f0f6c41e33e897b2db176432f5.

* use generic class 'other-nav' for tests

* pass a variable 'context' to the partial nav

* pass var 'context' to partial

* fix unwanted typo in partial sidebar

* Update app/views/admin/navigation_links/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/assets/javascripts/initializers/initializeReadingListIcons.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/assets/javascripts/initializers/initializeReadingListIcons.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* js-reading-list-count renaming

* use data-testid instead of generic classes for tests

* fix typo in specs

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-14 10:48:55 +01:00

30 lines
1.2 KiB
Text

<% default_nav_links = NavigationLink.default_section.ordered.to_a %>
<% other_nav_links = NavigationLink.other_section.ordered.to_a %>
<nav class="mb-4 <% unless user_signed_in? %>mt-4<% end %>" data-testid="main-nav" aria-label="<%= community_name %>">
<ul class="default-navigation-links sidebar-navigation-links spec-sidebar-navigation-links">
<% default_nav_links.each do |link| %>
<%= render "layouts/sidebar_nav_link", link: link %>
<% end %>
</ul>
</nav>
<%# Reading Note: There's a faulty assumption that all "other_nav_links" are
visible based on the current state (see
ApplicationHelper#display_navigation_link? for details). %>
<% if other_nav_links.any? %>
<nav class="mb-4" data-testid="other-nav" aria-labelledby="other-nav-heading-<%= context %>">
<h2 id="other-nav-heading-<%= context %>" class="crayons-subtitle-3 py-2 pl-3">
<%= t("views.main.nav.other") %>
</h2>
<ul class="other-navigation-links sidebar-navigation-links spec-sidebar-navigation-links">
<% other_nav_links.each do |link| %>
<%= render "layouts/sidebar_nav_link", link: link %>
<% end %>
</ul>
</nav>
<% end %>
<div class="flex justify-start mb-4">
<%= render partial: "layouts/social_media" %>
</div>