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 simplified-expenses-checker to use ERB templates for questions #2149

Conversation

floehopper
Copy link
Contributor

No description provided.

@chrisroos
Copy link
Contributor

Looks good to me.

@chrisroos chrisroos self-assigned this Nov 19, 2015
@chrisroos chrisroos added the LGTM label Nov 19, 2015
This results in more aesthetically pleasing HTML and should make it easier to
convert the flow to use ERB templates for questions.

I've updated the regression test artefacts and checksums accordingly.
I ran the following command:

    $ rails r script/convert-question-i18-yaml-to-erb-templates.rb lib/smart_answer_flows/simplified-expenses-checker
    Writing template: claimed_expenses_for_current_business.govspeak.erb
    Writing template: type_of_expense.govspeak.erb
    Writing template: buying_new_vehicle.govspeak.erb
    Writing template: capital_allowances.govspeak.erb
    Writing template: how_much_expect_to_claim.govspeak.erb
    Writing template: is_vehicle_green.govspeak.erb
    Writing template: price_of_vehicle.govspeak.erb
    Writing template: vehicle_business_use_time.govspeak.erb
    Writing template: drive_business_miles_car_van.govspeak.erb
    Writing template: drive_business_miles_motorcycle.govspeak.erb
    Writing template: current_claim_amount_home.govspeak.erb
    Writing template: hours_work_home.govspeak.erb
    Writing template: deduct_from_premises.govspeak.erb
    Writing template: people_live_on_premises.govspeak.erb

    Deleting i18n YAML: simplified-expenses-checker.yml

    Now insert `use_erb_templates_for_questions` at top of flow: simplified-expenses-checker.rb
Since #2098 & #2112, apostrophes rendered via `SmartAnswer::ErbRenderer` have
not been HTML-escaped. Now that we are rendering question content via this
renderer, we need to update the regression test artefacts for question pages
accordingly.

I ran the following commands to do this:

    $ find test/artefacts/simplified-expenses-checker -name '*.html' -print0 | xargs -0 sed -i .bak "s/'/'/g"
    $ git clean -fd test/artefacts/simplified-expenses-checker/**/*.bak
Since #2098 & #2112, ampersands rendered via `SmartAnswer::ErbRenderer` have
not been HTML-escaped. Now that we are rendering question content via this
renderer, we need to update the content in the ERB template to use the HTML
entity for ampersand.
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
Re-generating the checksums has removed the i18n YAML file and added the new
question templates as I expected.
@chrisroos chrisroos force-pushed the convert-simplified-expenses-checker-to-use-erb-templates-for-questions branch from 347e7cc to 365fa31 Compare November 19, 2015 17:47
@chrisroos
Copy link
Contributor

I've rebased this on master and force pushed in preparation for merging.

chrisroos added a commit that referenced this pull request Nov 19, 2015
…ecker-to-use-erb-templates-for-questions

Convert simplified-expenses-checker to use ERB templates for questions
@chrisroos chrisroos merged commit 58f6917 into master Nov 19, 2015
@chrisroos chrisroos deleted the convert-simplified-expenses-checker-to-use-erb-templates-for-questions branch November 19, 2015 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants