mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-10 21:34:10 -05:00
We feel that this is more appropriate because it’s part of the information you’re agreeing to before you hit submit. Sometimes users can missing information that doesn’t start left-aligned to the column they’re interacting with. It also makes it closer to the Design System component. We’re keeping it in the sticky footer, so that it’s always visible no matter where in the message you’re scrolled to (this means you won’t have to edited to content then scroll down to check whether you’ve made it fit).
67 lines
2.0 KiB
HTML
67 lines
2.0 KiB
HTML
{% macro textbox(
|
|
field,
|
|
label=None,
|
|
hint=False,
|
|
highlight_placeholders=False,
|
|
autofocus=False,
|
|
autosize=False,
|
|
colour_preview=False,
|
|
help_link=None,
|
|
help_link_text=None,
|
|
width='2-3',
|
|
suffix=None,
|
|
safe_error_message=False,
|
|
rows=8,
|
|
extra_form_group_classes=''
|
|
) %}
|
|
<div
|
|
class="form-group{% if field.errors %} form-group-error{% endif %} {{ extra_form_group_classes }}"
|
|
data-module="{% if autofocus %}autofocus{% elif colour_preview %}colour-preview{% endif %}"
|
|
>
|
|
<label class="form-label" for="{{ field.name }}">
|
|
{% if label %}
|
|
{{ label }}
|
|
{% else %}
|
|
{{ field.label.text }}
|
|
{% endif %}
|
|
{% if hint %}
|
|
<span class="form-hint">
|
|
{{ hint }}
|
|
</span>
|
|
{% endif %}
|
|
{% if field.errors %}
|
|
<span class="error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
|
|
{% if not safe_error_message %}{{ field.errors[0] }}{% else %}{{ field.errors[0]|safe }}{% endif %}
|
|
</span>
|
|
{% endif %}
|
|
</label>
|
|
{%
|
|
if highlight_placeholders or autosize
|
|
%}
|
|
{% set field_class = 'form-control-{} textbox-highlight-textbox'.format(width) %}
|
|
{% else %}
|
|
{% set field_class = 'form-control-{} {}'.format(width, 'textbox-right-aligned' if suffix else '') %}
|
|
{% endif %}
|
|
{%
|
|
set field_class = 'form-control ' + field_class + (
|
|
' form-control-error' if field.errors else ''
|
|
)
|
|
%}
|
|
{{ field(
|
|
class=field_class,
|
|
data_module='enhanced-textbox' if highlight_placeholders or autosize else '',
|
|
data_highlight_placeholders='true' if highlight_placeholders else 'false',
|
|
rows=rows|string,
|
|
**kwargs
|
|
) }}
|
|
{% if suffix %}
|
|
<span>{{ suffix }}</span>
|
|
{% endif %}
|
|
{% if help_link and help_link_text %}
|
|
<p class="textbox-help-link">
|
|
<a class="govuk-link govuk-link--no-visited-state" href='{{ help_link }}'>{{ help_link_text }}</a>
|
|
</p>
|
|
{% endif %}
|
|
</div>
|
|
{% endmacro %}
|