diff --git a/app/views/content_items/_context_and_title.html.erb b/app/views/content_items/_context_and_title.html.erb deleted file mode 100644 index c68512a07..000000000 --- a/app/views/content_items/_context_and_title.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<% - context_string = t("content_item.schema_name.#{@content_item.document_type}", count: 1); - context_inside = false; - %> - -<% @content_item&.featured_attachments.each do |fa| %> - <% return if !@content_item.attachment_details(fa).present? %> - <% if @content_item.attachment_details(fa)['title'] == @content_item.title %> - <% content_for :title do %> - <%= t("content_item.schema_name.#{@content_item.document_type}.overview", count: 1) %>: <%= @content_item.title %> - <% end %> - <% - context_string = t("content_item.schema_name.#{@content_item.document_type}.overview", count: 1) << ":" - context_inside = true - %> - <% break %> - <% end %> -<% end %> - -<%= render 'govuk_publishing_components/components/title', - context: context_string, - context_locale: t_locale_fallback("content_item.schema_name.#{@content_item.document_type}", count: 1), - context_inside: context_inside, - title: @content_item.title, - average_title_length: "long" - %> diff --git a/app/views/content_items/consultation.html.erb b/app/views/content_items/consultation.html.erb index a9a62231b..f92143163 100644 --- a/app/views/content_items/consultation.html.erb +++ b/app/views/content_items/consultation.html.erb @@ -6,7 +6,7 @@
- <%= render 'context_and_title' %> + <%= render 'govuk_publishing_components/components/title', @content_item.title_and_context %>
<%= render 'shared/translations' %>
diff --git a/app/views/content_items/publication.html.erb b/app/views/content_items/publication.html.erb index a3d944432..27c927ceb 100644 --- a/app/views/content_items/publication.html.erb +++ b/app/views/content_items/publication.html.erb @@ -8,7 +8,11 @@
- <%= render 'context_and_title' %> + <%= render 'govuk_publishing_components/components/title', + context: t("content_item.schema_name.#{@content_item.document_type}", count: 1), + context_locale: t_locale_fallback("content_item.schema_name.#{@content_item.document_type}", count: 1), + title: @content_item.title, + average_title_length: "long" %>
<%= render 'shared/translations' %> diff --git a/config/locales/en.yml b/config/locales/en.yml index c60fb932d..6eddaca39 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -84,7 +84,6 @@ en: closed_consultation: one: Closed consultation other: Closed consultations - overview: Closed consultation overview cma_case: one: Competition and Markets Authority case other: Competition and Markets Authority cases @@ -97,25 +96,21 @@ en: consultation_outcome: one: Consultation outcome other: Consultation outcomes - overview: Consultation outcome overview corporate_information_page: one: Information page other: Information pages corporate_report: one: Corporate report other: Corporate reports - overview: Corporate reports overview correspondence: one: Correspondence other: Correspondences - overview: Correspondence overview countryside_stewardship_grant: one: Countryside Stewardship grant other: Countryside Stewardship grants decision: one: Decision other: Decisions - overview: Decision overview detailed_guide: one: Guidance other: Guidance @@ -146,43 +141,36 @@ en: foi_release: one: FOI release other: FOI releases - overview: FOI release overview form: one: Form other: Forms - overview: Forms overview government_response: one: Government response other: Government responses guidance: one: Guidance other: Guidance - overview: Guidance overview impact_assessment: one: Impact assessment other: Impact assessments - overview: Impact assessment overview imported: one: imported - awaiting type other: imported - awaiting type independent_report: one: Independent report other: Independent reports - overview: Independent report overview international_development_fund: one: International development funding other: International development funding international_treaty: one: International treaty other: International treaties - overview: International treaty overview maib_report: one: Marine Accident Investigation Branch report other: Marine Accident Investigation Branch reports map: one: Map other: Maps - overview: Map overview medical_safety_alert: one: Alerts and recalls for drugs and medical devices other: Alerts and recalls for drugs and medical devices @@ -192,7 +180,6 @@ en: national_statistics: one: National statistics other: National statistics - overview: National statistics overview national_statistics_announcement: one: National statistics announcement other: National statistics announcements @@ -205,21 +192,18 @@ en: notice: one: Notice other: Notices - overview: Notice overview official: one: Official statistics announcement other: Official statistics announcements official_statistics: one: Official Statistics other: Official statistics - overview: Official statistics overview official_statistics_announcement: one: Official statistics announcement other: Official statistics announcements open_consultation: one: Open consultation other: Open consultations - overview: Open consultation overview oral_statement: one: Oral statement to Parliament other: Oral statements to Parliament @@ -229,14 +213,12 @@ en: policy_paper: one: Policy paper other: Policy papers - overview: Policy paper overview press_release: one: Press release other: Press releases promotional: one: Promotional material other: Promotional material - overview: Promotional material overview publication: one: Publication other: Publications @@ -246,11 +228,9 @@ en: regulation: one: Regulation other: Regulations - overview: Regulation overview research: one: Research and analysis other: Research and analysis - overview: Research and analysis overview residential_property_tribunal_decision: one: Residential property tribunal decision other: Residential property tribunal decisions @@ -269,7 +249,6 @@ en: standard: one: Standard other: Standards - overview: Standard overview statement_to_parliament: one: Statement to Parliament other: Statements to Parliament @@ -282,7 +261,6 @@ en: statutory_guidance: one: Statutory guidance other: Statutory guidance - overview: Statutory guidance overview take_part: one: Take part other: Take part @@ -295,7 +273,6 @@ en: transparency: one: Transparency data other: Transparency data - overview: Transparency data overview utaac_decision: one: Administrative appeals tribunal decision other: Administrative appeals tribunal decisions diff --git a/test/views/content_items/attachments.html.erb_test.rb b/test/views/content_items/attachments.html.erb_test.rb index 64aea883c..913d549ba 100644 --- a/test/views/content_items/attachments.html.erb_test.rb +++ b/test/views/content_items/attachments.html.erb_test.rb @@ -43,23 +43,4 @@ class ContentItemsAttachmentsTest < ActionView::TestCase assert_includes rendered, "gem-c-govspeak" assert_includes rendered, "some html" end - - test "renders overview title when attachment title matches parent" do - @content_item = PublicationPresenter.new( - { "document_type" => "correspondence", - "title" => "Matching", - "details" => { "attachments" => [{ "id" => "attachment_id", - "title" => "Matching", - "url" => "some/url" }], - "featured_attachments" => %w[attachment_id] } }, - "/publication", - ApplicationController.new.view_context, - ) - render( - partial: "content_items/context_and_title", - ) - - assert_includes rendered, "Correspondence overview:" - assert_select "h1 span" - end end