Skip to content

Commit d526d58

Browse files
committed
Move text into locale files
- english only at this point - simplify brexit_hub_page presenter
1 parent 7a43806 commit d526d58

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

app/presenters/content_item/brexit_hub_page.rb

+13-16
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,21 @@ module BrexitHubPage
66
BREXIT_BUSINESS_PAGE_PATH = "/guidance/brexit-guidance-for-businesses".freeze
77
BREXIT_CITIZEN_PAGE_PATH = "/guidance/brexit-guidance-for-individuals-and-families".freeze
88

9-
def brexit_hub_page?
10-
BREXIT_HUB_PAGE_CONTENT_IDS.include?(content_item.dig("content_id"))
9+
def brexit_links
10+
{
11+
ContentItem::BrexitHubPage::BREXIT_BUSINESS_PAGE_CONTENT_ID => {
12+
text: I18n.t("brexit.citizen_link"),
13+
path: BREXIT_CITIZEN_PAGE_PATH,
14+
},
15+
ContentItem::BrexitHubPage::BREXIT_CITIZEN_PAGE_CONTENT_ID => {
16+
text: I18n.t("brexit.business_link"),
17+
path: BREXIT_BUSINESS_PAGE_PATH,
18+
},
19+
}
1120
end
1221

13-
def brexit_business_page?
14-
BREXIT_BUSINESS_PAGE_CONTENT_ID == content_item.dig("content_id")
15-
end
16-
17-
def brexit_citizen_page?
18-
BREXIT_CITIZEN_PAGE_CONTENT_ID == content_item.dig("content_id")
19-
end
20-
21-
def brexit_citizen_page
22-
BREXIT_CITIZEN_PAGE_PATH
23-
end
24-
25-
def brexit_business_page
26-
BREXIT_BUSINESS_PAGE_PATH
22+
def brexit_link
23+
brexit_links[content_item.dig("content_id")]
2724
end
2825
end
2926
end

app/views/content_items/detailed_guide.html.erb

+7-9
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@
66

77
<div class="govuk-grid-row">
88
<div class="govuk-grid-column-two-thirds">
9-
<% title_and_context = @content_item.brexit_hub_page? ? { title: @content_item.title } : @content_item.title_and_context %>
9+
<% title_and_context = @content_item.brexit_link ? { title: @content_item.title } : @content_item.title_and_context %>
1010
<%= render 'govuk_publishing_components/components/title', title_and_context %>
1111
</div>
1212
<%= render 'shared/translations' %>
1313
<div class="govuk-grid-column-two-thirds">
14-
<% if @content_item.brexit_hub_page? %>
14+
<% if @content_item.brexit_link %>
1515
<div class="govuk-body-l govuk-!-margin-bottom-7">
16-
<% link_text = @content_item.brexit_citizen_page? ? "Brexit guidance for businesses" : "Brexit guidance for individuals and families" %>
17-
<% link_path = @content_item.brexit_citizen_page? ? @content_item.brexit_business_page : @content_item.brexit_citizen_page %>
1816
<p class="govuk-body">
19-
There's different <%= link_to link_text, link_path %>.
17+
<%= I18n.t("brexit.heading_prefix") %> <%= link_to @content_item.brexit_link[:text], @content_item.brexit_link[:path] %>.
2018
</p>
2119
</div>
2220
<% else %>
@@ -25,7 +23,7 @@
2523
</div>
2624
</div>
2725

28-
<%= render 'shared/publisher_metadata_with_logo' unless @content_item.brexit_hub_page? %>
26+
<%= render 'shared/publisher_metadata_with_logo' unless @content_item.brexit_link %>
2927
<%= render 'shared/history_notice', content_item: @content_item %>
3028
<%= render 'govuk_publishing_components/components/notice', @content_item.withdrawal_notice_component %>
3129

@@ -37,7 +35,7 @@
3735
<%= render "govuk_publishing_components/components/print_link", {
3836
margin_top: 0,
3937
margin_bottom: 6,
40-
} unless @content_item.brexit_hub_page? %>
38+
} unless @content_item.brexit_link %>
4139

4240
<%= render 'govuk_publishing_components/components/govspeak', {} do %>
4341
<%= raw(@content_item.govspeak_body[:content]) %>
@@ -48,13 +46,13 @@
4846
published: @content_item.published,
4947
last_updated: @content_item.updated,
5048
history: @content_item.history
51-
} unless @content_item.brexit_hub_page? %>
49+
} unless @content_item.brexit_link %>
5250
</div>
5351
<% end %>
5452
<%= render "govuk_publishing_components/components/print_link", {
5553
margin_top: 0,
5654
margin_bottom: 6,
57-
} unless @content_item.brexit_hub_page? %>
55+
} unless @content_item.brexit_link %>
5856
</div>
5957
<%= render 'shared/sidebar_navigation' %>
6058
</div>

app/views/layouts/application.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<% unless @do_not_show_breadcrumbs %>
4343
<% if @content_item.try(:back_link) %>
4444
<%= render 'govuk_publishing_components/components/back_link', href: @content_item.back_link %>
45-
<% elsif @content_item.brexit_hub_page? %>
45+
<% elsif @content_item.brexit_link %>
4646
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: [ { url: "/", title: "Home" } , { url: "/transition", title: "Brexit" } ] %>
4747
<% else %>
4848
<%= render 'govuk_publishing_components/components/contextual_breadcrumbs', content_item: @content_item.content_item.parsed_content %>

config/locales/en.yml

+4
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ en:
281281
written_statement:
282282
one: Written statement to Parliament
283283
other: Written statements to Parliament
284+
brexit:
285+
heading_prefix: There’s different
286+
business_link: Brexit guidance for businesses
287+
citizen_link: Brexit guidance for individuals and families
284288
corporate_information_page:
285289
about_our_services_html: Find out %{link}.
286290
corporate_information: Corporate information

0 commit comments

Comments
 (0)