Skip to content

Commit

Permalink
Merge pull request #1877 from alphagov/replace-nav
Browse files Browse the repository at this point in the history
Replace bespoke nav with contents list component
  • Loading branch information
maxgds authored Oct 19, 2020
2 parents 6ed7332 + 0eba0e8 commit 54f1a79
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
12 changes: 3 additions & 9 deletions app/assets/stylesheets/helpers/_parts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@
}

.part-navigation {
margin-bottom: 0;
@include govuk-font(19);
margin-left: 0;

@include govuk-media-query($from: tablet) {
@include govuk-font(16);
}

li {
list-style: none;
margin-bottom: 0.75em;
@include govuk-media-query($until: tablet) {
margin-left: govuk-spacing(1);
}
}

Expand Down
10 changes: 1 addition & 9 deletions app/views/content_items/travel_advice.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,7 @@

<aside class="part-navigation-container" role="complementary">
<nav role="navigation" class="govuk-grid-row part-navigation" aria-label="Travel advice pages" data-module="track-click">
<% @content_item.parts_navigation.each_with_index do |part_group, i| %>
<ol class="govuk-grid-column-one-half" <% if i == 1 %> start="<%= @content_item.parts_navigation_second_list_start %>" <% end %>>
<% part_group.each do |part_nav_item| %>
<li>
<%= part_nav_item %>
</li>
<% end %>
</ol>
<% end %>
<%= render "govuk_publishing_components/components/contents_list", contents: @content_item.part_link_elements, underline_links: true %>
</nav>

<%= render 'govuk_publishing_components/components/subscription-links', email_signup_link: @content_item.email_signup_link, feed_link: @content_item.feed_link %>
Expand Down
1 change: 0 additions & 1 deletion test/integration/travel_advice_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class TravelAdviceTest < ActionDispatch::IntegrationTest
assert page.has_css?("a[href=\"#{@content_item['details']['email_signup_link']}\"]", text: "Get email alerts")
assert page.has_css?("a[href=\"#{@content_item['base_path']}.atom\"]", text: "Subscribe to feed")

assert page.has_css?(".part-navigation ol", count: 2)
assert page.has_css?(".part-navigation li", count: @content_item["details"]["parts"].size + 1)
assert page.has_css?(".part-navigation li", text: "Summary")
assert_not page.has_css?(".part-navigation li a", text: "Summary")
Expand Down

0 comments on commit 54f1a79

Please sign in to comment.