mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-23 11:51:05 -05:00
Includes: - turning off :visited styles to match existing design - swapping heading classes used to make links bold for the GOVUK Frontend bold override class - adding visually hidden text to some links to make them work when isolated from their context We may need to revisit whether some links, such as those for documentation and features, may benefit from having some indication that their target has been visited.
43 lines
1.4 KiB
HTML
43 lines
1.4 KiB
HTML
{% from "components/button/macro.njk" import govukButton %}
|
|
|
|
{% macro file_upload(
|
|
field,
|
|
action=None,
|
|
button_text="Choose file",
|
|
alternate_link=None,
|
|
alternate_link_text=None,
|
|
hint=None,
|
|
show_errors=True
|
|
|
|
) %}
|
|
<form method="post" enctype="multipart/form-data" {% if action %}action="{{ action }}"{% endif %} class="{% if field.errors and show_errors %}form-group-error{% endif %}" data-module="file-upload">
|
|
<label class="file-upload-label" for="{{ field.name }}">
|
|
<span class="govuk-visually-hidden">{{ field.label.text }}</span>
|
|
{% if hint %}
|
|
<span class="form-hint">
|
|
{{ hint }}
|
|
</span>
|
|
{% endif %}
|
|
{% if field.errors and show_errors %}
|
|
<span class="error-message">
|
|
{{ field.errors[0] }}
|
|
</span>
|
|
{% endif %}
|
|
</label>
|
|
{{ field(**{
|
|
'class': 'file-upload-field'
|
|
}) }}
|
|
<label class="file-upload-button" for="{{ field.name }}">
|
|
{{ button_text }}
|
|
</label>
|
|
{% if alternate_link and alternate_link_text %}
|
|
<span class="file-upload-alternate-link">
|
|
or <a class="govuk-link govuk-link--no-visited-state" href="{{ alternate_link }}">{{ alternate_link_text }}</a>
|
|
</span>
|
|
{% endif %}
|
|
<label class="file-upload-filename" for="{{ field.name }}"></label>
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
|
{{ govukButton({ "text": "Submit", "classes": "file-upload-submit" }) }}
|
|
</form>
|
|
{% endmacro %}
|