From 2b05bed0c64af879633bcf1172090749672ec5de Mon Sep 17 00:00:00 2001 From: Jessica Jones Date: Fri, 10 Jan 2025 16:05:53 +0000 Subject: [PATCH] Jess changes --- ...worldwide_corporate_information_page_presenter.rb | 4 ++++ app/presenters/worldwide_office_presenter.rb | 4 ++++ app/presenters/worldwide_organisation_presenter.rb | 12 ++++++++++++ .../worldwide_organisation/_header.html.erb | 5 ++--- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/presenters/worldwide_corporate_information_page_presenter.rb b/app/presenters/worldwide_corporate_information_page_presenter.rb index d305f5d84..695a64b40 100644 --- a/app/presenters/worldwide_corporate_information_page_presenter.rb +++ b/app/presenters/worldwide_corporate_information_page_presenter.rb @@ -7,6 +7,10 @@ def formatted_title worldwide_organisation&.formatted_title end + def show_title_under_logo? + false + end + def show_default_breadcrumbs? false end diff --git a/app/presenters/worldwide_office_presenter.rb b/app/presenters/worldwide_office_presenter.rb index d65d7fc63..997a52cf0 100644 --- a/app/presenters/worldwide_office_presenter.rb +++ b/app/presenters/worldwide_office_presenter.rb @@ -6,6 +6,10 @@ def formatted_title worldwide_organisation&.formatted_title end + def show_title_under_logo? + false + end + def body content_item.dig("details", "access_and_opening_times") end diff --git a/app/presenters/worldwide_organisation_presenter.rb b/app/presenters/worldwide_organisation_presenter.rb index 667d7aea4..868f18da7 100644 --- a/app/presenters/worldwide_organisation_presenter.rb +++ b/app/presenters/worldwide_organisation_presenter.rb @@ -2,6 +2,7 @@ class WorldwideOrganisationPresenter < ContentItemPresenter include ContentItem::Body include WorldwideOrganisation::Branding include ActionView::Helpers::UrlHelper + include ActionView::Helpers::SanitizeHelper WorldwideOffice = Struct.new(:contact, :has_access_and_opening_times?, :public_url, keyword_init: true) @@ -9,6 +10,17 @@ def formatted_title content_item.dig("details", "logo", "formatted_title") end + def show_title_under_logo? + return if sponsoring_organisations.empty? + + logo_title = strip_tags(formatted_title).gsub(/\s+/, "") + page_title = content_item["title"].gsub(/\s+/, "") + + return if logo_title == page_title + + true + end + def sponsoring_organisation_links return if sponsoring_organisations.empty? diff --git a/app/views/content_items/worldwide_organisation/_header.html.erb b/app/views/content_items/worldwide_organisation/_header.html.erb index 6c566a91c..5ab1d70ec 100644 --- a/app/views/content_items/worldwide_organisation/_header.html.erb +++ b/app/views/content_items/worldwide_organisation/_header.html.erb @@ -2,14 +2,13 @@