From 7db4a6efe613aa875d06f55b035ba8b170253f89 Mon Sep 17 00:00:00 2001 From: James Mead Date: Thu, 19 Nov 2015 14:47:16 +0000 Subject: [PATCH 1/4] Use ERB templates for Qs in register-a-death I ran the following command: $ rails r script/convert-question-i18-yaml-to-erb-templates.rb lib/smart_answer_flows/register-a-death Writing template: where_did_the_death_happen.govspeak.erb Writing template: did_the_person_die_at_home_hospital.govspeak.erb Writing template: was_death_expected.govspeak.erb Writing template: which_country.govspeak.erb Writing template: where_are_you_now.govspeak.erb Writing template: which_country_are_you_in_now.govspeak.erb Deleting i18n YAML: register-a-death.yml Now insert `use_erb_templates_for_questions` at top of flow: register-a-death.rb --- .../locales/en/register-a-death.yml | 30 ------------------- ...e_person_die_at_home_hospital.govspeak.erb | 8 +++++ .../questions/was_death_expected.govspeak.erb | 8 +++++ .../questions/where_are_you_now.govspeak.erb | 9 ++++++ .../where_did_the_death_happen.govspeak.erb | 10 +++++++ .../questions/which_country.govspeak.erb | 3 ++ .../which_country_are_you_in_now.govspeak.erb | 3 ++ 7 files changed, 41 insertions(+), 30 deletions(-) delete mode 100644 lib/smart_answer_flows/locales/en/register-a-death.yml create mode 100644 lib/smart_answer_flows/register-a-death/questions/did_the_person_die_at_home_hospital.govspeak.erb create mode 100644 lib/smart_answer_flows/register-a-death/questions/was_death_expected.govspeak.erb create mode 100644 lib/smart_answer_flows/register-a-death/questions/where_are_you_now.govspeak.erb create mode 100644 lib/smart_answer_flows/register-a-death/questions/where_did_the_death_happen.govspeak.erb create mode 100644 lib/smart_answer_flows/register-a-death/questions/which_country.govspeak.erb create mode 100644 lib/smart_answer_flows/register-a-death/questions/which_country_are_you_in_now.govspeak.erb diff --git a/lib/smart_answer_flows/locales/en/register-a-death.yml b/lib/smart_answer_flows/locales/en/register-a-death.yml deleted file mode 100644 index ea6b96e1458..00000000000 --- a/lib/smart_answer_flows/locales/en/register-a-death.yml +++ /dev/null @@ -1,30 +0,0 @@ -en-GB: - flow: - register-a-death: - where_did_the_death_happen?: - title: Where did the death happen? - options: - england_wales: "England or Wales" - scotland: "Scotland" - northern_ireland: "Northern Ireland" - overseas: "Abroad" - did_the_person_die_at_home_hospital?: - title: Did the person die at home, in hospital or elsewhere? - options: - at_home_hospital: "At home or in hospital" - elsewhere: "Elsewhere" - was_death_expected?: - title: Was the death expected? - options: - "yes": "Yes" - "no": "No" - which_country?: - title: Which country did the death happen in? - where_are_you_now?: - title: Where are you now? - options: - same_country: "In the country where the death happened" - another_country: "In another country" - in_the_uk: "In the UK" - which_country_are_you_in_now?: - title: Which country are you in now? diff --git a/lib/smart_answer_flows/register-a-death/questions/did_the_person_die_at_home_hospital.govspeak.erb b/lib/smart_answer_flows/register-a-death/questions/did_the_person_die_at_home_hospital.govspeak.erb new file mode 100644 index 00000000000..2efac3c310f --- /dev/null +++ b/lib/smart_answer_flows/register-a-death/questions/did_the_person_die_at_home_hospital.govspeak.erb @@ -0,0 +1,8 @@ +<% content_for :title do %> + Did the person die at home, in hospital or elsewhere? +<% end %> + +<% options( + "at_home_hospital": "At home or in hospital", + "elsewhere": "Elsewhere" +) %> diff --git a/lib/smart_answer_flows/register-a-death/questions/was_death_expected.govspeak.erb b/lib/smart_answer_flows/register-a-death/questions/was_death_expected.govspeak.erb new file mode 100644 index 00000000000..58618300552 --- /dev/null +++ b/lib/smart_answer_flows/register-a-death/questions/was_death_expected.govspeak.erb @@ -0,0 +1,8 @@ +<% content_for :title do %> + Was the death expected? +<% end %> + +<% options( + "yes": "Yes", + "no": "No" +) %> diff --git a/lib/smart_answer_flows/register-a-death/questions/where_are_you_now.govspeak.erb b/lib/smart_answer_flows/register-a-death/questions/where_are_you_now.govspeak.erb new file mode 100644 index 00000000000..c23739a3867 --- /dev/null +++ b/lib/smart_answer_flows/register-a-death/questions/where_are_you_now.govspeak.erb @@ -0,0 +1,9 @@ +<% content_for :title do %> + Where are you now? +<% end %> + +<% options( + "same_country": "In the country where the death happened", + "another_country": "In another country", + "in_the_uk": "In the UK" +) %> diff --git a/lib/smart_answer_flows/register-a-death/questions/where_did_the_death_happen.govspeak.erb b/lib/smart_answer_flows/register-a-death/questions/where_did_the_death_happen.govspeak.erb new file mode 100644 index 00000000000..56501271955 --- /dev/null +++ b/lib/smart_answer_flows/register-a-death/questions/where_did_the_death_happen.govspeak.erb @@ -0,0 +1,10 @@ +<% content_for :title do %> + Where did the death happen? +<% end %> + +<% options( + "england_wales": "England or Wales", + "scotland": "Scotland", + "northern_ireland": "Northern Ireland", + "overseas": "Abroad" +) %> diff --git a/lib/smart_answer_flows/register-a-death/questions/which_country.govspeak.erb b/lib/smart_answer_flows/register-a-death/questions/which_country.govspeak.erb new file mode 100644 index 00000000000..449cf335864 --- /dev/null +++ b/lib/smart_answer_flows/register-a-death/questions/which_country.govspeak.erb @@ -0,0 +1,3 @@ +<% content_for :title do %> + Which country did the death happen in? +<% end %> diff --git a/lib/smart_answer_flows/register-a-death/questions/which_country_are_you_in_now.govspeak.erb b/lib/smart_answer_flows/register-a-death/questions/which_country_are_you_in_now.govspeak.erb new file mode 100644 index 00000000000..2d15df333ba --- /dev/null +++ b/lib/smart_answer_flows/register-a-death/questions/which_country_are_you_in_now.govspeak.erb @@ -0,0 +1,3 @@ +<% content_for :title do %> + Which country are you in now? +<% end %> From caa97206f06448dbd5c9c79bb679ac31e82dc22a Mon Sep 17 00:00:00 2001 From: James Mead Date: Thu, 19 Nov 2015 14:48:08 +0000 Subject: [PATCH 2/4] Now insert use_erb_templates_for_questions at top of flow --- lib/smart_answer_flows/register-a-death.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/smart_answer_flows/register-a-death.rb b/lib/smart_answer_flows/register-a-death.rb index f58fa14ef49..e6c6466f3a0 100644 --- a/lib/smart_answer_flows/register-a-death.rb +++ b/lib/smart_answer_flows/register-a-death.rb @@ -6,6 +6,8 @@ def define status :published satisfies_need "101006" + use_erb_templates_for_questions + country_name_query = SmartAnswer::Calculators::CountryNameFormatter.new reg_data_query = SmartAnswer::Calculators::RegistrationsDataQuery.new translator_query = SmartAnswer::Calculators::TranslatorLinks.new From 6fd71b89dccbad9206a76c676c3cabcde13e45ea Mon Sep 17 00:00:00 2001 From: James Mead Date: Thu, 19 Nov 2015 14:48:54 +0000 Subject: [PATCH 3/4] Update regression test artefacts The change to ERB templates has introduced a few extra newlines in the question page HTML, but none of them affect the content viewable by the user. I verified that the changes were all only blank lines using the following command: $ git diff --ignore-blank-lines --- test/artefacts/register-a-death/england_wales.html | 2 ++ .../register-a-death/england_wales/at_home_hospital.html | 2 ++ test/artefacts/register-a-death/overseas.html | 2 ++ test/artefacts/register-a-death/overseas/libya.html | 2 ++ .../register-a-death/overseas/libya/another_country.html | 2 ++ test/artefacts/register-a-death/y.html | 2 ++ 6 files changed, 12 insertions(+) diff --git a/test/artefacts/register-a-death/england_wales.html b/test/artefacts/register-a-death/england_wales.html index cba4e5ee45c..986287e4a0f 100644 --- a/test/artefacts/register-a-death/england_wales.html +++ b/test/artefacts/register-a-death/england_wales.html @@ -38,6 +38,7 @@

+
    @@ -57,6 +58,7 @@

    +

diff --git a/test/artefacts/register-a-death/england_wales/at_home_hospital.html b/test/artefacts/register-a-death/england_wales/at_home_hospital.html index 1c2900e0fdc..36d39026b71 100644 --- a/test/artefacts/register-a-death/england_wales/at_home_hospital.html +++ b/test/artefacts/register-a-death/england_wales/at_home_hospital.html @@ -38,6 +38,7 @@

+
    @@ -57,6 +58,7 @@

    +

diff --git a/test/artefacts/register-a-death/overseas.html b/test/artefacts/register-a-death/overseas.html index c557f1519c0..9a41469c8ca 100644 --- a/test/artefacts/register-a-death/overseas.html +++ b/test/artefacts/register-a-death/overseas.html @@ -38,6 +38,7 @@

+
@@ -269,6 +270,7 @@

+

diff --git a/test/artefacts/register-a-death/y.html b/test/artefacts/register-a-death/y.html index 7c0f5b59f1a..c9348c21ad1 100644 --- a/test/artefacts/register-a-death/y.html +++ b/test/artefacts/register-a-death/y.html @@ -38,6 +38,7 @@

+
    @@ -69,6 +70,7 @@

    +

From bd708475501c6e742762ea6aa49c71b1861783d4 Mon Sep 17 00:00:00 2001 From: James Mead Date: Thu, 19 Nov 2015 14:49:11 +0000 Subject: [PATCH 4/4] Update regression test checksums Re-generating the checksums has removed the i18n YAML file and added the new question templates as I expected. --- test/data/register-a-death-files.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/data/register-a-death-files.yml b/test/data/register-a-death-files.yml index d083a1f934c..a6b97a09a05 100644 --- a/test/data/register-a-death-files.yml +++ b/test/data/register-a-death-files.yml @@ -1,6 +1,5 @@ --- -lib/smart_answer_flows/register-a-death.rb: 378f810da11670f93cadef74954fe302 -lib/smart_answer_flows/locales/en/register-a-death.yml: 04de0b215b1ab22ce4a52a82a185f6f1 +lib/smart_answer_flows/register-a-death.rb: 5dc3d844027c0d7624d007aca5fb2932 test/data/register-a-death-questions-and-responses.yml: bae21b0a8be1bbaa2dd6febd505382d6 test/data/register-a-death-responses-and-expected-results.yml: a69c595900ab2d85208c0ac92f186ae8 lib/smart_answer_flows/register-a-death/outcomes/_footnote_oru_variants.govspeak.erb: 30e012cdde5aa7f4de5856a5db47a54c @@ -9,6 +8,12 @@ lib/smart_answer_flows/register-a-death/outcomes/no_embassy_result.govspeak.erb: lib/smart_answer_flows/register-a-death/outcomes/north_korea_result.govspeak.erb: d21f96d5816ca222f381a2bca6ced918 lib/smart_answer_flows/register-a-death/outcomes/oru_result.govspeak.erb: 897de72bc4ec3f2570a58d44fa76051f lib/smart_answer_flows/register-a-death/outcomes/uk_result.govspeak.erb: 662da9367c5992191471f8722b3c2636 +lib/smart_answer_flows/register-a-death/questions/did_the_person_die_at_home_hospital.govspeak.erb: 3405db8cb8b24782fc49981c2fce12e7 +lib/smart_answer_flows/register-a-death/questions/was_death_expected.govspeak.erb: 132d4a52801b619af05519a69f2767dd +lib/smart_answer_flows/register-a-death/questions/where_are_you_now.govspeak.erb: b11b29b04cec875529be3714b5fba89e +lib/smart_answer_flows/register-a-death/questions/where_did_the_death_happen.govspeak.erb: 65a1c9d38940b468014b59160047f2c0 +lib/smart_answer_flows/register-a-death/questions/which_country.govspeak.erb: e816742682e96117df80d67faff13fc8 +lib/smart_answer_flows/register-a-death/questions/which_country_are_you_in_now.govspeak.erb: 9c9399d1588c7d5e01ebf1bf5efa31a1 lib/smart_answer_flows/register-a-death/register_a_death.govspeak.erb: 1820ba3a5f3ed47816c7f151217be439 lib/data/rates/births_and_deaths_document_return_fees.yml: 4ac203e9fd076c12f62b57f8d1b64ffc lib/data/translators.yml: d86f628f0b85e24ffb0dc0ec77401387