Skip to content

Commit

Permalink
Rename instances of TitleAndContext/title_and_context to HeadingAndCo…
Browse files Browse the repository at this point in the history
…ntext/heading_and_context

Due to replacing the title component with the heading component, this naming seems to fit better.
  • Loading branch information
JamesCGDS committed Feb 13, 2025
1 parent c94865a commit 3b47a99
Show file tree
Hide file tree
Showing 38 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion app/presenters/call_for_evidence_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CallForEvidencePresenter < ContentItemPresenter
include ContentItem::Political
include ContentItem::Shareable
include ContentItem::SinglePageNotificationButton
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext

def opening_date_time
content_item["details"]["opening_date"]
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/case_study_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CaseStudyPresenter < ContentItemPresenter
include ContentItem::Body
include ContentItem::Metadata
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext

def image
content_item["details"]["image"]
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/consultation_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ConsultationPresenter < ContentItemPresenter
include ContentItem::Political
include ContentItem::Shareable
include ContentItem::SinglePageNotificationButton
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext

def opening_date_time
content_item["details"]["opening_date"]
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/contact_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class ContactPresenter < ContentItemPresenter
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include ContentItem::ContactDetails

def title_and_context
def heading_and_context
super.tap do |t|
t[:font_size] = "xl"
t.delete(:context)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module ContentItem
module TitleAndContext
def title_and_context
module HeadingAndContext
def heading_and_context
{
text: title,
context: I18n.t("content_item.schema_name.#{document_type}", count: 1),
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/corporate_information_page_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CorporateInformationPagePresenter < ContentItemPresenter
include ContentItem::Body
include ContentItem::ContentsList
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include ContentItem::OrganisationBranding
include ContentItem::CorporateInformationGroups

Expand All @@ -11,7 +11,7 @@ def page_title
page_title
end

def title_and_context
def heading_and_context
super.tap do |t|
t[:font_size] = "xl"
t.delete(:context)
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/detailed_guide_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ class DetailedGuidePresenter < ContentItemPresenter
include ContentItem::Metadata
include ContentItem::NationalApplicability
include ContentItem::Political
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include ContentItem::SinglePageNotificationButton

def title_and_context
def heading_and_context
super.tap do |t|
t[:context] = I18n.t("content_item.schema_name.guidance", count: 1)
end
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/document_collection_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class DocumentCollectionPresenter < ContentItemPresenter
include ContentItem::Body
include ContentItem::Metadata
include ContentItem::Political
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include ContentItem::ContentsList
include ContentItem::SinglePageNotificationButton
include DocumentCollection::SignupLink
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/fatality_notice_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class FatalityNoticePresenter < ContentItemPresenter
include ContentItem::Body
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include ContentItem::Metadata

def field_of_operation
Expand All @@ -23,7 +23,7 @@ def important_metadata
end
end

def title_and_context
def heading_and_context
super.tap do |t|
if field_of_operation
t[:context] = I18n.t("fatality_notice.operations_in", location: field_of_operation.try(:title))
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/field_of_operation_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class FieldOfOperationPresenter < ContentItemPresenter
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext

FatalityNotice = Struct.new(:roll_call_introduction, :casualties, :title, :base_path)

def title_and_context
def heading_and_context
super.tap do |t|
t[:context] = I18n.t("field_of_operation.context")
t[:text] = "#{I18n.t('field_of_operation.title')} #{@content_item['title']}"
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/fields_of_operation_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class FieldsOfOperationPresenter < ContentItemPresenter
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext

def fields_of_operation
content_item.dig("links", "fields_of_operation").map { |field| [field["title"], field["base_path"]] }
end

def title_and_context
def heading_and_context
super.tap do |t|
t[:context] = I18n.t("fields_of_operation.context")
t[:font_size] = "xl"
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/news_article_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class NewsArticlePresenter < ContentItemPresenter
include ContentItem::Linkable
include ContentItem::Updatable
include ContentItem::Shareable
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include ContentItem::Metadata
include ContentItem::NewsImage
end
4 changes: 2 additions & 2 deletions app/presenters/specialist_document_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class SpecialistDocumentPresenter < ContentItemPresenter
include ContentItem::Body
include ContentItem::Updatable
include ContentItem::Linkable
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include ContentItem::Metadata
include TypographyHelper
include ContentItem::ContentsList

def title_and_context
def heading_and_context
super.tap do |t|
t.delete(:context)
end
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/speech_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class SpeechPresenter < ContentItemPresenter
include ContentItem::Linkable
include ContentItem::Political
include ContentItem::Updatable
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include ContentItem::Metadata
include ContentItem::NewsImage

Expand Down
2 changes: 1 addition & 1 deletion app/presenters/statistical_data_set_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class StatisticalDataSetPresenter < ContentItemPresenter
include ContentItem::Body
include ContentItem::ContentsList
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include ContentItem::Political
include ContentItem::Metadata
end
2 changes: 1 addition & 1 deletion app/presenters/statistics_announcement_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class StatisticsAnnouncementPresenter < ContentItemPresenter
include ContentItem::Metadata
include ContentItem::NationalStatisticsLogo
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext
include StatisticsAnnouncementHelper

FORTHCOMING_NOTICE = I18n.t("statistics_announcement.forthcoming").freeze
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/topical_event_about_page_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class TopicalEventAboutPagePresenter < ContentItemPresenter
include ContentItem::Body
include ContentItem::ContentsList
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext

def title_and_context
def heading_and_context
super.tap do |t|
t[:font_size] = "xl"
t.delete(:context)
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/working_group_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class WorkingGroupPresenter < ContentItemPresenter
include ContentItem::Body
include ContentItem::ContentsList
include ContentItem::TitleAndContext
include ContentItem::HeadingAndContext

def email
content_item["details"]["email"]
Expand All @@ -19,7 +19,7 @@ def policies
content_item["links"]["policies"]
end

def title_and_context
def heading_and_context
super.tap do |t|
t[:font_size] = "xl"
t.delete(:context)
Expand Down
4 changes: 2 additions & 2 deletions app/views/content_items/call_for_evidence.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
) %>
<% end %>

<%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.title_and_context[:title] } %>
<%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.heading_and_context[:title] } %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/case_study.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="govuk-grid-column-two-thirds">
Expand Down
4 changes: 2 additions & 2 deletions app/views/content_items/consultation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
) %>
<% end %>

<%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.title_and_context[:title] } %>
<%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.heading_and_context[:title] } %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/contact.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions app/views/content_items/detailed_guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
) %>
<% end %>

<%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.title_and_context[:title] } %>
<%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.heading_and_context[:title] } %>

<div class="govuk-grid-row gem-print-columns-none">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="govuk-grid-column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/document_collection.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
) %>
<% end %>

<%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.title_and_context[:title] } %>
<%= render 'shared/email_subscribe_unsubscribe_flash', { title: @content_item.heading_and_context[:title] } %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/fatality_notice.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="govuk-grid-column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/field_of_operation.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="govuk-width-container">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render "govuk_publishing_components/components/heading", @content_item.title_and_context %>
<%= render "govuk_publishing_components/components/heading", @content_item.heading_and_context %>
</div>
<div class="govuk-grid-column-one-third govuk-!-margin-top-8 govuk-!-margin-bottom-8">
<%= render "govuk_publishing_components/components/organisation_logo", {
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/fields_of_operation.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/news_article.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="govuk-grid-row gem-print-columns-none">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="govuk-grid-column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/specialist_document.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="govuk-grid-column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/speech.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="govuk-grid-row gem-print-columns-none">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="govuk-grid-column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/statistics_announcement.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
<%= render 'govuk_publishing_components/components/lead_paragraph', text: @content_item.description %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/working_group.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
<div class="govuk-grid-column-two-thirds">
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_title_and_translations.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds responsive-top-margin">
<%= render 'govuk_publishing_components/components/heading', @content_item.title_and_context %>
<%= render 'govuk_publishing_components/components/heading', @content_item.heading_and_context %>
</div>
<%= render 'shared/translations' %>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def schema_name
assert presented_item.is_a?(ContentItem::HeadingAndContext)
heading_component_params = { text: "About us", context_locale: :en, heading_level: 1, margin_bottom: 8, font_size: "xl" }

assert_equal heading_component_params, presented_item.title_and_context
assert_equal heading_component_params, presented_item.heading_and_context
end

test "has organisation branding" do
Expand Down
2 changes: 1 addition & 1 deletion test/presenters/detailed_guide_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def schema_name

test "context in title is overridden to display as guidance" do
I18n.with_locale("fr") do
assert_equal I18n.t("content_item.schema_name.guidance", count: 1), presented_item.title_and_context[:context]
assert_equal I18n.t("content_item.schema_name.guidance", count: 1), presented_item.heading_and_context[:context]
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/presenters/field_of_operation_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def schema_name
margin_bottom: 8,
font_size: "xl",
}
assert_equal expected_heading_and_context, presented_item.title_and_context
assert_equal expected_heading_and_context, presented_item.heading_and_context
end

test "it presents a description" do
Expand Down
2 changes: 1 addition & 1 deletion test/presenters/fields_of_operation_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def schema_name
font_size: "xl",
}

assert_equal heading_component_params, presented_item.title_and_context
assert_equal heading_component_params, presented_item.heading_and_context
end

test "presents the fields of operation" do
Expand Down
Loading

0 comments on commit 3b47a99

Please sign in to comment.