-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #859 from alphagov/fix-the-hovering-blue-sidebar-o…
…n-pages-without-related-links Avoid rendering the side content when there's no content
- Loading branch information
Showing
2 changed files
with
39 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
<% | ||
sections ||= [] | ||
%> | ||
<aside class="govuk-related-items" role="complementary"> | ||
<% sections.each do |section| %> | ||
<h2 | ||
<% if section[:id] %>id="<%= section[:id] %>"<% end %> | ||
> | ||
<%= section[:title] %> | ||
</h2> | ||
<nav role="navigation" <% if section[:id] %>aria-labelledby="<%= section[:id] %>"<% end %>> | ||
<ul> | ||
<% section[:items].each do |item| %> | ||
<li> | ||
<a | ||
href="<%= item[:url] %>" | ||
<% if item[:rel] %>rel="<%= item[:rel] %>"<% end %> | ||
> | ||
<%= item[:title] %> | ||
</a> | ||
</li> | ||
<% end %> | ||
<% if section[:url] %> | ||
<li class="related-items-more"> | ||
<a href="<%= section[:url] %>"> | ||
<%= t("govuk_component.related_items.more", default: "More") %> | ||
<% if section[:title] %> | ||
<span class="visuallyhidden"> | ||
<%= t("govuk_component.related_items.in", default: "in") %> | ||
<%= section[:title] %> | ||
</span> | ||
<% end %> | ||
</a> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</nav> | ||
<% end %> | ||
</aside> | ||
<% if local_assigns[:sections] && !sections.blank? %> | ||
<aside class="govuk-related-items" role="complementary"> | ||
<% sections.each do |section| %> | ||
<h2 | ||
<% if section[:id] %>id="<%= section[:id] %>"<% end %> | ||
> | ||
<%= section[:title] %> | ||
</h2> | ||
<nav role="navigation" <% if section[:id] %>aria-labelledby="<%= section[:id] %>"<% end %>> | ||
<ul> | ||
<% section[:items].each do |item| %> | ||
<li> | ||
<a | ||
href="<%= item[:url] %>" | ||
<% if item[:rel] %>rel="<%= item[:rel] %>"<% end %> | ||
> | ||
<%= item[:title] %> | ||
</a> | ||
</li> | ||
<% end %> | ||
<% if section[:url] %> | ||
<li class="related-items-more"> | ||
<a href="<%= section[:url] %>"> | ||
<%= t("govuk_component.related_items.more", default: "More") %> | ||
<% if section[:title] %> | ||
<span class="visuallyhidden"> | ||
<%= t("govuk_component.related_items.in", default: "in") %> | ||
<%= section[:title] %> | ||
</span> | ||
<% end %> | ||
</a> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</nav> | ||
<% end %> | ||
</aside> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters