Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove taxon-list app component from collections #3844

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading