Skip to content

Commit 24f7805

Browse files
committed
Merge pull request #2156 from alphagov/convert-uk-benefits-abroad-to-use-erb-templates-for-questions
Convert uk-benefits-abroad to use ERB templates for questions
2 parents c1ef639 + f6206f6 commit 24f7805

File tree

52 files changed

+393
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+393
-290
lines changed

lib/smart_answer_flows/locales/en/uk-benefits-abroad.yml

-235
This file was deleted.

lib/smart_answer_flows/uk-benefits-abroad.rb

+19-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ def define
66
status :published
77
satisfies_need "100490"
88

9+
use_erb_templates_for_questions
10+
911
exclude_countries = %w(british-antarctic-territory french-guiana guadeloupe holy-see martinique mayotte reunion st-maarten)
1012
additional_countries = [OpenStruct.new(slug: "jersey", name: "Jersey"), OpenStruct.new(slug: "guernsey", name: "Guernsey")]
1113

@@ -18,11 +20,19 @@ def define
1820
save_input_as :going_or_already_abroad
1921

2022
calculate :country_question_title do
21-
PhraseList.new(:"#{going_or_already_abroad}_country_question_title")
23+
if going_or_already_abroad == "going_abroad"
24+
"Which country are you moving to?"
25+
else
26+
"Which country are you living in?"
27+
end
2228
end
2329

2430
calculate :why_abroad_question_title do
25-
PhraseList.new(:"why_#{going_or_already_abroad}_title")
31+
if going_or_already_abroad == "going_abroad"
32+
"Why are you going abroad?"
33+
else
34+
"Why have you gone abroad?"
35+
end
2636
end
2737

2838
calculate :going_abroad do
@@ -34,7 +44,7 @@ def define
3444
end
3545

3646
calculate :already_abroad_text_two do |response|
37-
PhraseList.new(:already_abroad_text_two) if already_abroad
47+
" or permanently" if already_abroad
3848
end
3949

4050
next_node :which_benefit?
@@ -59,9 +69,13 @@ def define
5969

6070
calculate :how_long_question_titles do
6171
if benefit == "disability_benefits"
62-
PhraseList.new(:"#{benefit}_how_long_question_title")
72+
"How long will you be abroad for?"
6373
else
64-
PhraseList.new(:"#{going_or_already_abroad}_how_long_question_title")
74+
if going_or_already_abroad == "going_abroad"
75+
"How long are you going abroad for?"
76+
else
77+
"How long will you be living abroad for?"
78+
end
6579
end
6680
end
6781

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<% content_for :title do %>
2+
Are you or a family member getting State Pension, Industrial Injuries Benefit, ESA (contributory) or bereavement benefits?
3+
<% end %>
4+
5+
<% options(
6+
"yes": "Yes",
7+
"no": "No"
8+
) %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<% content_for :title do %>
2+
<%= how_long_question_titles %>
3+
<% end %>
4+
5+
<% options(
6+
"temporary": "Temporarily, eg for a holiday",
7+
"permanent": "Permanently"
8+
) %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<% content_for :title do %>
2+
Does the following apply to you?
3+
<% end %>
4+
5+
<% options(
6+
"yes": "Yes",
7+
"no": "No"
8+
) %>
9+
10+
<% content_for :body do %>
11+
You're currently receiving at least one of the following UK benefits:
12+
13+
- Bereavement benefits
14+
- Severe Disablement Allowance
15+
- Employment and Support Allowance
16+
- Incapacity Benefit
17+
- Industrial Injuries Disablement Benefit
18+
- State Pension
19+
20+
<% end %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<% content_for :title do %>
2+
Are you eligible for Statutory Maternity Pay?
3+
<% end %>
4+
5+
<% options(
6+
"yes": "Yes",
7+
"no": "No"
8+
) %>
9+
10+
<% content_for :body do %>
11+
If you're unsure you can read our [Maternity pay and leave guide](/statutory-maternity-pay#eligibility)
12+
13+
<% end %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<% content_for :title do %>
2+
Are you or your partner one of the following?
3+
<% end %>
4+
5+
<% options(
6+
"crown_servant": "A Crown servant",
7+
"cross_border_worker": "A cross-border worker",
8+
"none_of_the_above": "None of the above"
9+
) %>
10+
11+
<% content_for :hint do %>
12+
A Crown servant is someone who works for the UK government. A cross-border worker is someone who regularly travels to or from another country to work.
13+
<% end %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<% content_for :title do %>
2+
Is your employer paying National Insurance contributions for you?
3+
<% end %>
4+
5+
<% options(
6+
"yes": "Yes",
7+
"no": "No"
8+
) %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<% content_for :title do %>
2+
<%= how_long_question_titles %>
3+
<% end %>
4+
5+
<% options(
6+
"esa_under_a_year_medical": "Less than 1 year, to get medical treatment for yourself or your child",
7+
"esa_under_a_year_other": "Less than 1 year, for a different reason",
8+
"esa_more_than_a_year": "More than 1 year#{already_abroad_text_two}"
9+
) %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<% content_for :title do %>
2+
Are you currently:
3+
<% end %>
4+
5+
<% options(
6+
"going_abroad": "in the UK and planning to move abroad",
7+
"already_abroad": "someone who has lived and worked in the UK who is now living abroad"
8+
) %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<% content_for :title do %>
2+
Are you currently receiving Industrial Injuries Disablement Benefit?
3+
<% end %>
4+
5+
<% options(
6+
"yes": "Yes",
7+
"no": "No"
8+
) %>

0 commit comments

Comments
 (0)