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

Add line break functionality to instruction and description #196

Merged
merged 13 commits into from
Jul 21, 2020

Conversation

iwootten
Copy link
Contributor

What is the context of this PR?

Break current question description into a list to allow for multiple paragraphs. Additionally makes format_paragraphs a macro and adds it to the helpers.html.

Depends on ONSdigital/eq-translations#62 and ONSdigital/eq-questionnaire-validator#50 to be merged prior to this.

How to review

Open a schema using a description (test_markup) and confirm the description continues to be displayed correctly.

Checklist

@iwootten
Copy link
Contributor Author

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
tag=latest
tag=make-description-list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder to revert before merge


{% set save_on_signout = true %}

{% set continue_button_text = _("Continue") %}

{% block form_content %}
{% set interstitial_instruction = format_paragraphs(block.content.instruction) if block.content.instruction else None %}
{% set interstitial_instruction = format_paragraphs([block.content.instruction]) if block.content.instruction else None %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to pass an empty iterable to format_paragraph and have it not output anything by using the {% else %} operator when we iterate

Suggested change
{% set interstitial_instruction = format_paragraphs([block.content.instruction]) if block.content.instruction else None %}
{% set interstitial_instruction = format_paragraphs([block.content.instruction])

templates/macros/helpers.html Outdated Show resolved Hide resolved
"instruction": "Just pause for a second",
"instruction": [
"Just pause for a second"
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also have a question instruction in a test schema.

@iwootten iwootten changed the title Add line break functionality in question description Add line break functionality to instruction and description Jul 21, 2020
@iwootten iwootten merged commit 85af154 into master Jul 21, 2020
@iwootten iwootten deleted the make-description-list branch July 21, 2020 12:20
@pricem14pc pricem14pc added this to the v3.46.0 milestone Jul 30, 2020
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.

4 participants