Skip to content

Commit

Permalink
Merge pull request #2352 from alphagov/439_Implement-new-Summary_Card…
Browse files Browse the repository at this point in the history
…-component

439 implement new summary card component
  • Loading branch information
davidtrussler authored Oct 2, 2024
2 parents c1adbe6 + 5998450 commit d86ae49
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 73 deletions.
13 changes: 0 additions & 13 deletions app/assets/stylesheets/_summary-card.scss

This file was deleted.

2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ $govuk-page-width: 1140px;
@import 'govuk_publishing_components/components/select';
@import 'govuk_publishing_components/components/skip-link';
@import 'govuk_publishing_components/components/success-alert';
@import 'govuk_publishing_components/components/summary-card';
@import 'govuk_publishing_components/components/summary-list';
@import 'govuk_publishing_components/components/table';
@import 'govuk_publishing_components/components/textarea';
@import 'govuk_publishing_components/components/title';
@import "tags";
@import "downtimes";
@import "publications";
@import "summary-card";
@import "popular_links";
@import "editions";
4 changes: 2 additions & 2 deletions app/views/homepage/popular_links/_link.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render "shared/summary_card", {
title: "Link #{index +1}" ,
<%= render "govuk_publishing_components/components/summary_card", {
title: "Link #{index +1}",
rows: popular_link_rows(item),
} %>
5 changes: 2 additions & 3 deletions app/views/homepage/popular_links/_version_and_status.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<% status_tags = { :published=> "govuk-tag--green", :draft => "govuk-tag--yellow" } %>
<% status_tag = tag.strong status.capitalize, class: ["govuk-tag",status_tags[status.to_sym]] %>
<% status_tag = tag.strong status.humanize, class: "govuk-tag govuk-tag--#{status}" %>
<%= render "govuk_publishing_components/components/summary_list", {
items: [
Expand All @@ -12,4 +11,4 @@
value: status_tag,
},
],
} %>
} %>
15 changes: 11 additions & 4 deletions app/views/homepage/popular_links/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<% content_for :page_title, "Popular on GOV.UK" %>
<% content_for :title, "Popular on GOV.UK" %>
<% content_for :title_context, "Homepage" %>

<div class="govuk-grid-column-two-thirds">
<%= render "homepage/popular_links/version_and_status", version: @latest_popular_links.version_number, status: @latest_popular_links.state %>
<% @latest_popular_links.link_items.each_with_index do |item, index| %>
<%= render "homepage/popular_links/link", item:, index: %>
<% end %>
<section>
<%= render "homepage/popular_links/version_and_status", version: @latest_popular_links.version_number, status: @latest_popular_links.state %>
</section>

<section>
<% @latest_popular_links.link_items.each_with_index do |item, index| %>
<%= render "homepage/popular_links/link", item:, index: %>
<% end %>
</section>
</div>

<div class = "govuk-grid-column-one-third popular-links__sidebar" >
<%= render "homepage/popular_links/sidebar" %>
</div>
47 changes: 0 additions & 47 deletions app/views/shared/_summary_card.html.erb

This file was deleted.

6 changes: 3 additions & 3 deletions test/integration/homepage_popular_links_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HomepagePopularLinksTest < JavascriptIntegrationTest
assert page.has_text?(@popular_links.version_number)
assert page.has_text?("Status")
assert page.has_text?("Published")
assert page.has_css?(".govuk-tag--green")
assert page.has_css?(".govuk-tag--published")
end

should "have link to view 'GOV.UK'" do
Expand All @@ -58,7 +58,7 @@ class HomepagePopularLinksTest < JavascriptIntegrationTest

should "render new draft popular links with edit option when 'Create new edition' button is clicked" do
click_button("Create new edition")
within(:css, ".govuk-tag--yellow") do
within(:css, ".govuk-tag--draft") do
assert page.has_content?("Draft")
end
end
Expand All @@ -72,7 +72,7 @@ class HomepagePopularLinksTest < JavascriptIntegrationTest
assert page.has_text?(@popular_links.version_number)
assert page.has_text?("Status")
assert page.has_text?("Draft")
assert page.has_css?(".govuk-tag--yellow")
assert page.has_css?(".govuk-tag--draft")
assert page.has_text?("Edit popular links")
end

Expand Down

0 comments on commit d86ae49

Please sign in to comment.