Skip to content

Commit

Permalink
Merge pull request #1204 from alphagov/revert-1200-update-taxonomy-si…
Browse files Browse the repository at this point in the history
…debar-design

Revert "Update design of taxonomy sidebar"
  • Loading branch information
Vanita Barrett authored Nov 29, 2017
2 parents 517a19f + a3e9578 commit 087f0f3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 34 deletions.
38 changes: 15 additions & 23 deletions app/assets/stylesheets/govuk-component/_taxonomy-sidebar.scss
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
.govuk-taxonomy-sidebar {
border-top: 2px solid $govuk-blue;
padding-top: $gutter-half;
border-top: 10px solid $mainstream-brand;
padding-top: 5px;
@include core-16;

.govuk-taxonomy-sidebar__heading {
margin-top: 0;
margin-bottom: $gutter-one-third;
@include bold-19;
h2 {
@include bold-24;
margin-top: 0.3em;
margin-bottom: 0.5em;
}

.taxon-description {
margin-top: 0;
margin-bottom: $gutter-one-third;
}

a {
text-decoration: none;
}

nav {
margin-bottom: $gutter;
}

li {
padding: 0;
list-style-type: none;
margin-bottom: $gutter-one-third;
margin-bottom: 0.75em;
}

ul {
// reset the default browser styles
padding: 0;
margin: 0;
list-style: none;
margin-bottom: 1.25em;
}

li {
// reset the default browser styles
padding: 0;
margin-bottom: 0.75em;
}
}
}
2 changes: 1 addition & 1 deletion app/views/govuk_component/docs/taxonomy_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ examples:
link: /government/collections/key-stage-1-teacher-assessment
- title: "Primary assessments: information and resources for 2017"
link: /government/publications/primary-assessments-information-and-resources-for-2017
- title: "Slide pack from Phil Beach at the Skills & Employability Summit"
- title: "Slide pack from Phil Beach at the Skills & Employability Summit"
link: /government/publications/primary-assessments-information-and-resources-for-2017
- title: "Transport to education and training for people aged 16 to 18"
link: /government/publications/primary-assessments-information-and-resources-for-2017
Expand Down
5 changes: 2 additions & 3 deletions app/views/govuk_component/taxonomy_sidebar.raw.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<% if local_assigns[:items] && !items.blank? %>

<aside class='govuk-taxonomy-sidebar' data-module='track-click' role='complementary'>
<h2 class='govuk-taxonomy-sidebar__heading'><%= t("govuk_component.taxonomy_sidebar.related_content") %></h2>
<% items.each_with_index do |item, item_index| %>
<div class='sidebar-taxon' data-track-count="sidebarTaxonSection">
<h3 class='govuk-taxonomy-sidebar__heading'>
<h2>
<%=
link_to_if(
item[:url],
Expand All @@ -22,7 +21,7 @@
},
)
%>
</h3>
</h2>

<p class='taxon-description'>
<%= item[:description] %>
Expand Down
2 changes: 0 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ en:
related_items:
more: "More"
in: "in"
taxonomy_sidebar:
related_content: "Related content"
10 changes: 5 additions & 5 deletions test/govuk_component/taxonomy_sidebar_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def component_name
]
)

taxon_titles = css_select(".sidebar-taxon h3").map { |taxon_title| taxon_title.text.strip }
taxon_titles = css_select(".sidebar-taxon h2").map { |taxon_title| taxon_title.text.strip }
assert_equal ["Item 1 title", "Item 2 title"], taxon_titles
end

Expand Down Expand Up @@ -70,7 +70,7 @@ def component_name
total_sections = 2
total_links_in_section_1 = 3

assert_select 'h3 a', "Item title"
assert_select 'h2 a', "Item title"
assert_select '.govuk-taxonomy-sidebar[data-module="track-click"]', 1
assert_tracking_link("category", "relatedLinkClicked", 6)

Expand All @@ -94,7 +94,7 @@ def component_name
end


test "renders without url on the h3 heading" do
test "renders without url on the h2 heading" do
render_component(
items: [
{
Expand All @@ -114,7 +114,7 @@ def component_name
]
)

assert_select 'h3', "Without an url"
assert_select 'h3 a', false
assert_select 'h2', "Without an url"
assert_select 'h2 a', false
end
end

0 comments on commit 087f0f3

Please sign in to comment.