Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert uk-benefits-abroad to use ERB templates for questions #2156

Merged
235 changes: 0 additions & 235 deletions lib/smart_answer_flows/locales/en/uk-benefits-abroad.yml

This file was deleted.

24 changes: 19 additions & 5 deletions lib/smart_answer_flows/uk-benefits-abroad.rb
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ def define
status :published
satisfies_need "100490"

use_erb_templates_for_questions

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

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

calculate :country_question_title do
PhraseList.new(:"#{going_or_already_abroad}_country_question_title")
if going_or_already_abroad == "going_abroad"
"Which country are you moving to?"
else
"Which country are you living in?"
end
end

calculate :why_abroad_question_title do
PhraseList.new(:"why_#{going_or_already_abroad}_title")
if going_or_already_abroad == "going_abroad"
"Why are you going abroad?"
else
"Why have you gone abroad?"
end
end

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

calculate :already_abroad_text_two do |response|
PhraseList.new(:already_abroad_text_two) if already_abroad
" or permanently" if already_abroad
end

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

calculate :how_long_question_titles do
if benefit == "disability_benefits"
PhraseList.new(:"#{benefit}_how_long_question_title")
"How long will you be abroad for?"
else
PhraseList.new(:"#{going_or_already_abroad}_how_long_question_title")
if going_or_already_abroad == "going_abroad"
"How long are you going abroad for?"
else
"How long will you be living abroad for?"
end
end
end

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<% content_for :title do %>
Are you or a family member getting State Pension, Industrial Injuries Benefit, ESA (contributory) or bereavement benefits?
<% end %>

<% options(
"yes": "Yes",
"no": "No"
) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<% content_for :title do %>
<%= how_long_question_titles %>
<% end %>

<% options(
"temporary": "Temporarily, eg for a holiday",
"permanent": "Permanently"
) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<% content_for :title do %>
Does the following apply to you?
<% end %>

<% options(
"yes": "Yes",
"no": "No"
) %>

<% content_for :body do %>
You're currently receiving at least one of the following UK benefits:

- Bereavement benefits
- Severe Disablement Allowance
- Employment and Support Allowance
- Incapacity Benefit
- Industrial Injuries Disablement Benefit
- State Pension

<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<% content_for :title do %>
Are you eligible for Statutory Maternity Pay?
<% end %>

<% options(
"yes": "Yes",
"no": "No"
) %>

<% content_for :body do %>
If you're unsure you can read our [Maternity pay and leave guide](/statutory-maternity-pay#eligibility)

<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<% content_for :title do %>
Are you or your partner one of the following?
<% end %>

<% options(
"crown_servant": "A Crown servant",
"cross_border_worker": "A cross-border worker",
"none_of_the_above": "None of the above"
) %>

<% content_for :hint do %>
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.
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<% content_for :title do %>
Is your employer paying National Insurance contributions for you?
<% end %>

<% options(
"yes": "Yes",
"no": "No"
) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<% content_for :title do %>
<%= how_long_question_titles %>
<% end %>

<% options(
"esa_under_a_year_medical": "Less than 1 year, to get medical treatment for yourself or your child",
"esa_under_a_year_other": "Less than 1 year, for a different reason",
"esa_more_than_a_year": "More than 1 year#{already_abroad_text_two}"
) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<% content_for :title do %>
Are you currently:
<% end %>

<% options(
"going_abroad": "in the UK and planning to move abroad",
"already_abroad": "someone who has lived and worked in the UK who is now living abroad"
) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<% content_for :title do %>
Are you currently receiving Industrial Injuries Disablement Benefit?
<% end %>

<% options(
"yes": "Yes",
"no": "No"
) %>
Loading