Reduce spacing between textbox and ‘I have’t rec…’

The grouping on this page was weird because these links were two far away from
the associated textbox, and too close to the next textbox.

This commit adds them as parameters to the textbox macro, which means their
relative spacing can be controlled exactly, and thus reduced.
This commit is contained in:
Chris Hill-Scott
2016-02-02 15:12:59 +00:00
parent a09bd7bf9e
commit 71fd7f98a7
3 changed files with 20 additions and 9 deletions

View File

@@ -81,3 +81,7 @@
}
.textbox-help-link {
margin: 5px 0 0 0;
}

View File

@@ -1,4 +1,4 @@
{% macro textbox(field, hint=False, highlight_tags=False) %}
{% macro textbox(field, hint=False, highlight_tags=False, help_link=None, help_link_text=None) %}
<div class="form-group{% if field.errors %} error{% endif %}">
<label class="form-label" for="{{ field.name }}">
{{ field.label }}
@@ -17,5 +17,10 @@
'class': 'form-control textbox-highlight-textbox' if highlight_tags else 'form-control',
'data-module': 'highlight-tags' if highlight_tags else ''
}) }}
{% if help_link and help_link_text %}
<p class="textbox-help-link">
<a href='{{ help_link }}'>{{ help_link_text }}</a>
</p>
{% endif %}
</div>
{% endmacro %}

View File

@@ -15,14 +15,16 @@ GOV.UK Notify | Confirm email address and mobile number
<p>Weve sent you confirmation codes by email and text message. You need to enter both codes here.</p>
<form autocomplete="off" method="post">
{{ textbox(form.email_code) }}
<p>
<a href="{{ url_for('.check_and_resend_email_code')}}">I havent received an email</a>
</p>
{{ textbox(form.sms_code) }}
<p>
<a href="{{ url_for('.check_and_resend_text_code') }}">I havent received a text</a></span>
</p>
{{ textbox(
form.email_code,
help_link=url_for('.check_and_resend_email_code'),
help_link_text='I havent received an email'
) }}
{{ textbox(
form.sms_code,
help_link=url_for('.check_and_resend_text_code'),
help_link_text='I havent received a text'
) }}
{{ page_footer("Continue") }}
</form>
</div>