Skip to content

Commit

Permalink
Jess changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hannako committed Jan 10, 2025
1 parent 99c7c9d commit 1eff53c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/presenters/worldwide_office_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions app/presenters/worldwide_organisation_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@ 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)

def formatted_title
content_item.dig("details", "logo", "formatted_title")
end

def show_title_under_logo?
return if sponsoring_organisations.empty?
return if formatted_title.nil? || content_item["title"].nil?

logo_title = strip_tags(formatted_title).gsub(/\s+/, "")
page_title = content_item["title"].gsub(/\s+/, "")

logo_title != page_title
end

def sponsoring_organisation_links
return if sponsoring_organisations.empty?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
<div class="govuk-grid-column-two-thirds worldwide-organisation-header__logo">
<%= render "govuk_publishing_components/components/organisation_logo", {
organisation: @content_item.organisation_logo,
heading_level: 2,
inline: true,
margin_bottom: @content_item.show_title_under_logo? ? 8 : 0,
} %>
<% if @content_item.sponsoring_organisations.present? %>
<% if @content_item.show_title_under_logo? %>
<%= render "govuk_publishing_components/components/heading", {
text: @content_item.title,
heading_level: 1,
inline: true,
} %>
<% end %>
</div>
Expand Down

0 comments on commit 1eff53c

Please sign in to comment.