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 important metadata component #3414

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ $govuk-include-default-font-face: false;
.constrained-image {
max-width: 100%;
}

.inverse-background {
background: $govuk-brand-colour;
color: govuk-colour("white");
}
52 changes: 0 additions & 52 deletions app/assets/stylesheets/components/_important-metadata.scss

This file was deleted.

21 changes: 0 additions & 21 deletions app/views/components/_important_metadata.html.erb

This file was deleted.

36 changes: 0 additions & 36 deletions app/views/components/docs/important_metadata.yml

This file was deleted.

11 changes: 9 additions & 2 deletions app/views/content_items/document_collection.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render 'components/important_metadata',
items: @content_item.important_metadata %>
<% if @content_item.important_metadata.any? %>
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
<%= render "govuk_publishing_components/components/metadata", {
inverse: true,
other: @content_item.important_metadata,
margin_bottom: 0,
} %>
<% end %>
<% end %>

<%= render "components/contents_list_with_body", contents: @content_item.contents do %>
<div class="responsive-bottom-margin">
Expand Down
12 changes: 10 additions & 2 deletions app/views/content_items/fatality_notice.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@
<div class="govuk-grid-column-two-thirds">
<div class="content-bottom-margin">
<div class="responsive-bottom-margin">
<%= render 'components/important_metadata',
items: @content_item.important_metadata %>
<% if @content_item.important_metadata.any? %>
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
<%= render "govuk_publishing_components/components/metadata", {
inverse: true,
other: @content_item.important_metadata,
margin_bottom: 0,
} %>
<% end %>
<% end %>

<%= render 'components/figure',
src: @content_item.image["url"],
alt: @content_item.image["alt_text"],
Expand Down
11 changes: 9 additions & 2 deletions app/views/content_items/specialist_document.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render 'components/important_metadata',
items: @content_item.important_metadata %>
<% if @content_item.important_metadata.any? %>
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
<%= render "govuk_publishing_components/components/metadata", {
inverse: true,
other: @content_item.important_metadata,
margin_bottom: 0,
} %>
<% end %>
<% end %>

<%= render "components/contents_list_with_body", contents: @content_item.contents do %>

Expand Down
11 changes: 9 additions & 2 deletions app/views/content_items/speech.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@
<div class="govuk-grid-column-two-thirds">
<div class="content-bottom-margin">
<div class="responsive-bottom-margin">
<%= render 'components/important_metadata',
items: @content_item.important_metadata %>
<% if @content_item.important_metadata.any? %>
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
<%= render "govuk_publishing_components/components/metadata", {
inverse: true,
other: @content_item.important_metadata,
margin_bottom: 0,
} %>
<% end %>
<% end %>

<%= render 'components/figure',
src: @content_item.image["url"],
Expand Down
10 changes: 9 additions & 1 deletion app/views/content_items/statistical_data_set.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@
<%= render 'shared/publisher_metadata_with_logo' %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render 'components/important_metadata', items: @content_item.important_metadata %>
<% if @content_item.important_metadata.any? %>
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
<%= render "govuk_publishing_components/components/metadata", {
inverse: true,
other: @content_item.important_metadata,
margin_bottom: 0,
} %>
<% end %>
<% end %>

<%= render "components/contents_list_with_body", contents: @content_item.contents do %>
<div class="responsive-bottom-margin">
Expand Down
31 changes: 20 additions & 11 deletions app/views/content_items/statistics_announcement.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,29 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render "components/important_metadata",
items: @content_item.important_metadata,
margin_bottom: true %>
<% if @content_item.important_metadata.any? %>
<%= content_tag :div, class: "important-metadata inverse-background" do %>
<%= render "govuk_publishing_components/components/metadata", {
inverse: true,
other: @content_item.important_metadata,
margin_bottom: 0,
} %>
<% end %>
<% end %>

<% if @content_item.release_date_changed? %>
<div class="release-date-changed">
<%= render "components/important_metadata",
title: t("statistics_announcement.changed_date"),
items: {
t("statistics_announcement.previous_date") => @content_item.previous_release_date,
t("statistics_announcement.reason_for_change") => @content_item.release_date_change_reason,
},
margin_bottom: true
%>
<%= content_tag :div, class: "inverse-background" do %>
<%= render "govuk_publishing_components/components/metadata", {
inverse: true,
other: {
t("statistics_announcement.previous_date") => @content_item.previous_release_date,
t("statistics_announcement.reason_for_change") => @content_item.release_date_change_reason,
},
margin_bottom: 0,
title: t("statistics_announcement.changed_date"),
} %>
<% end %>
</div>
<% end %>

Expand Down
1 change: 0 additions & 1 deletion config/initializers/dartsass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"components/_contents-list-with-body.scss" => "components/_contents-list-with-body.css",
"components/_download-link.scss" => "components/_download-link.css",
"components/_figure.scss" => "components/_figure.css",
"components/_important-metadata.scss" => "components/_important-metadata.css",
"components/_published-dates.scss" => "components/_published-dates.css",
"views/_guide.scss" => "views/_guide.css",
"views/_html-publication.scss" => "views/_html-publication.css",
Expand Down
56 changes: 0 additions & 56 deletions test/components/important_metadata_test.rb

This file was deleted.

4 changes: 2 additions & 2 deletions test/integration/fatality_notice_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FatalityNoticeTest < ActionDispatch::IntegrationTest
from: {
"Ministry of Defence": "/government/organisations/ministry-of-defence",
},
})
}, context_selector: ".metadata-column")

assert_has_important_metadata(
"Field of operation": { "Zululand": "/government/fields-of-operation/zululand" },
Expand Down Expand Up @@ -60,7 +60,7 @@ class FatalityNoticeTest < ActionDispatch::IntegrationTest
assert_has_metadata({ from: {
"Ministry of Defence": "/government/organisations/ministry-of-defence",
"The Rt Hon Sir Eric Pickles MP": "/government/people/eric-pickles",
} })
} }, context_selector: ".metadata-column")
end

test "fatality notice with withdrawn notice" do
Expand Down
2 changes: 1 addition & 1 deletion test/integration/publication_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PublicationTest < ActionDispatch::IntegrationTest
"Environment Agency": "/government/organisations/environment-agency",
"The Rt Hon Sir Eric Pickles MP": "/government/people/eric-pickles",
},
})
}, context_selector: ".metadata-column")

assert_has_structured_data(page, "Article")

Expand Down
2 changes: 1 addition & 1 deletion test/integration/specialist_document_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SpecialistDocumentTest < ActionDispatch::IntegrationTest
"Air Accidents Investigation Branch":
"/government/organisations/air-accidents-investigation-branch",
},
})
}, context_selector: ".metadata-column")
end

test "renders published and updated in metadata" do
Expand Down
2 changes: 1 addition & 1 deletion test/integration/speech_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SpeechTest < ActionDispatch::IntegrationTest
"The Rt Hon Andrea Leadsom MP": "/government/people/andrea-leadsom",
},
published: "8 March 2016",
})
}, context_selector: ".metadata-column")

assert_has_important_metadata(
"Delivered on":
Expand Down
3 changes: 2 additions & 1 deletion test/integration/statistical_data_set_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class StatisticalDataSetTest < ActionDispatch::IntegrationTest
assert_has_metadata({
published: "13 December 2012",
from: { "Department for Transport": "/government/organisations/department-for-transport" },
})
}, context_selector: ".metadata-column")

assert_footer_has_published_dates("Published 13 December 2012")
end

Expand Down
4 changes: 2 additions & 2 deletions test/integration/statistics_announcement_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class StatisticsAnnouncementTest < ActionDispatch::IntegrationTest
assert page.has_text?(@content_item["description"])
assert page.has_css?('img[alt="Accredited official statistics"]')

within ".app-c-important-metadata" do
within ".important-metadata .gem-c-metadata" do
assert page.has_text?(:all, "Release date: January 2016 (provisional)")
end
end
Expand Down Expand Up @@ -45,7 +45,7 @@ class StatisticsAnnouncementTest < ActionDispatch::IntegrationTest
assert page.has_text?(@content_item["description"])
assert page.has_text?(:all, "Release date: 20 January 2016 9:30am (confirmed)")

within ".release-date-changed .app-c-important-metadata" do
within ".release-date-changed .gem-c-metadata" do
assert page.has_text?("The release date has been changed")
assert page.has_text?("Previous date")
assert page.has_text?("19 January 2016 9:30am")
Expand Down
Loading
Loading