Skip to content

Commit

Permalink
Merge pull request #3844 from alphagov/remove-taxon-list-component
Browse files Browse the repository at this point in the history
Remove taxon-list app component from collections
  • Loading branch information
MartinJJones authored Dec 17, 2024
2 parents f6be2c5 + da64b05 commit a03356a
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 244 deletions.
15 changes: 0 additions & 15 deletions app/assets/stylesheets/components/_taxon-list.scss

This file was deleted.

9 changes: 6 additions & 3 deletions app/helpers/taxon_list_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ module TaxonListHelper
def taxon_list_params(presented_taxon)
presented_taxon.tagged_content.each.map do |content_item|
{
path: content_item.base_path,
text: content_item.title,
description: content_item.description,
link: {
path: content_item.base_path,
text: content_item.title,
description: content_item.description,
full_size_description: true,
},
}
end
end
Expand Down
41 changes: 0 additions & 41 deletions app/views/components/_taxon_list.html.erb

This file was deleted.

80 changes: 0 additions & 80 deletions app/views/components/docs/taxon_list.yml

This file was deleted.

15 changes: 8 additions & 7 deletions app/views/roles/_past_role_holders.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
text: t("roles.previous_holders"),
margin_bottom: 2,
} %>
<%= render "components/taxon_list", {
heading_level: 3,
<%= render "govuk_publishing_components/components/list", {
list_type: "number",
items: role.past_holders.map do |rh|
{
text: rh['title'],
path: rh['base_path'],
description: "#{rh['details']['start_year']} to #{rh['details']['end_year']}",
}
sanitize(
"<h3 class='govuk-heading-s govuk-!-margin-bottom-1'>
<a href=#{rh['base_path']} class='govuk-link'>#{rh['title']}</a>
</h3>
<p class='govuk-body'>#{rh['details']['start_year']} to #{rh['details']['end_year']}</p>"
)
end
} %>
</section>
Expand Down
8 changes: 4 additions & 4 deletions app/views/world_wide_taxons/_tagged_content_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<% if presented_taxon.tagged_content.any? %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<% heading_level = heading_level ? heading_level : false %>
<%= render 'components/taxon_list', {
heading_level: heading_level,
items: taxon_list_params(presented_taxon)
<%= render "govuk_publishing_components/components/document_list", {
remove_top_border: true,
disable_ga4: true,
items: taxon_list_params(presented_taxon)
} %>
</div>
</div>
Expand Down
9 changes: 5 additions & 4 deletions app/views/world_wide_taxons/accordion.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
%>
<% presented_taxon.accordion_content.each_with_index do |taxon, index| %>
<% contents = capture do %>
<%= render 'components/taxon_list', {
heading_level: 3,
items: taxon_list_params(taxon)
} %>
<%= render "govuk_publishing_components/components/document_list", {
remove_top_border: true,
disable_ga4: true,
items: taxon_list_params(taxon)
} %>
<% end %>
<%
id = taxon.base_path || taxon.title.downcase.tr(" ","-")
Expand Down
1 change: 0 additions & 1 deletion config/initializers/dartsass.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
APP_STYLESHEETS = {
"components/_taxon-list.scss" => "components/_taxon-list.css",
"components/_document-navigation-list.scss" => "components/_document-navigation-list.css",
"views/_browse.scss" => "views/_browse.css",
"views/_bunting.scss" => "views/_bunting.css",
Expand Down
86 changes: 0 additions & 86 deletions spec/components/taxon_list_spec.rb

This file was deleted.

18 changes: 18 additions & 0 deletions spec/features/world_location_taxon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@
expect(page).to have_selector("a[href='#{email_url}']", text: "Get emails for this topic")
end

scenario "contains a link and description for each search result" do
world_usa = world_usa_taxon(base_path:, phase: "live")
world_usa_news_events = world_usa_news_events_taxon(base_path: child_taxon_base_path)

stub_content_store_has_item(base_path, world_usa)
stub_content_store_has_item(child_taxon_base_path, world_usa_news_events)
stub_content_for_taxon(taxon.content_id, search_results) # For the "general information" taxon
stub_most_popular_content_for_taxon(taxon.content_id, search_results, filter_content_store_document_type: nil)
stub_content_for_taxon(child_taxon.content_id, search_results)

visit base_path

search_results.each do |content|
expect(page).to have_link(content["title"], href: content["link"], class: "govuk-link")
expect(page.has_css?(".gem-c-document-list__item-description", text: content["description"])).to be(true)
end
end

private

def search_results
Expand Down
15 changes: 12 additions & 3 deletions spec/features/world_wide_taxon_browsing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def then_i_see_the_taxon_page

def and_i_can_see_the_content_tagged_to_the_taxon
tagged_content.each do |content|
expect(page).to have_link(content["title"])
expect(page).to have_link(content["title"], href: content["link"], class: "govuk-link")
expect(page.has_css?(".gem-c-document-list__item-description", text: content["description"])).to be(true)
end
end

Expand Down Expand Up @@ -116,8 +117,16 @@ def content_id

def tagged_content
[
{ title: "Hey hello" },
{ title: "How are you" },
{
"title" => "Hey hello",
"link" => "hey-hello",
"description" => "Description for hey hello",
},
{
"title" => "How are you",
"link" => "how-are-you",
"description" => "Description for how are you",
},
]
end
end

0 comments on commit a03356a

Please sign in to comment.