mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 23:08:07 -04:00
added id and required field
This commit is contained in:
@@ -1024,3 +1024,7 @@ nav.nav {
|
|||||||
font-size: units(3);
|
font-size: units(3);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-control-error {
|
||||||
|
border: 4px solid #b10e1e
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
attributes: params.errorMessage.attributes,
|
attributes: params.errorMessage.attributes,
|
||||||
html: params.errorMessage.html,
|
html: params.errorMessage.html,
|
||||||
text: params.errorMessage.text,
|
text: params.errorMessage.text,
|
||||||
visuallyHiddenText: params.errorMessage.visuallyHiddenText
|
visuallyHiddenText: params.errorMessage.visuallyHiddenText,
|
||||||
}) | indent(2) | trim }}
|
}) | indent(2) | trim }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input class="usa-input {%- if params.classes %} {{ params.classes }}{% endif %} {%- if params.errorMessage %} usa-input--error{% endif %}" id="{{ params.id }}" name="{{ params.name }}" type="{{ params.type | default('text') }}"
|
<input class="usa-input {%- if params.classes %} {{ params.classes }}{% endif %} {%- if params.errorMessage %} usa-input--error{% endif %}" id="{{ params.id }}" name="{{ params.name }}" type="{{ params.type | default('text') }}"
|
||||||
@@ -42,5 +42,7 @@
|
|||||||
{%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
|
{%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
|
||||||
{%- if params.autocomplete %} autocomplete="{{ params.autocomplete}}"{% endif %}
|
{%- if params.autocomplete %} autocomplete="{{ params.autocomplete}}"{% endif %}
|
||||||
{%- if params.pattern %} pattern="{{ params.pattern }}"{% endif %}
|
{%- if params.pattern %} pattern="{{ params.pattern }}"{% endif %}
|
||||||
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}
|
||||||
|
{%- if params.required %} required{% endif %}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,19 +16,9 @@
|
|||||||
placeholder=''
|
placeholder=''
|
||||||
) %}
|
) %}
|
||||||
<div
|
<div
|
||||||
class="form-group{% if field.errors %} form-group-error{% endif %} {{ extra_form_group_classes }}"
|
class="usa-form-group{% if field.errors %} usa-form-group--error{% endif %} {{ extra_form_group_classes }}"
|
||||||
data-module="{% if autofocus %}autofocus{% elif colour_preview %}colour-preview{% endif %}"
|
data-module="{% if autofocus %}autofocus{% elif colour_preview %}colour-preview{% endif %}"
|
||||||
>
|
>
|
||||||
{% if field.errors %}
|
|
||||||
<div class="usa-alert usa-alert--error edit-textbox-error-mt" role="alert">
|
|
||||||
<div class="usa-alert__body">
|
|
||||||
<h4 class="usa-alert__heading">Error message</h4>
|
|
||||||
<p class="usa-alert__text" 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 %}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<label class="usa-label" for="{{ field.name }}">
|
<label class="usa-label" for="{{ field.name }}">
|
||||||
{% if label %}
|
{% if label %}
|
||||||
{{ label }}
|
{{ label }}
|
||||||
@@ -41,6 +31,12 @@
|
|||||||
{{ hint }}
|
{{ hint }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if field.errors %}
|
||||||
|
<span id="{{ field.name}}-error" class="usa-error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}" tabindex="-1" aria-live="assertive" role="alert">
|
||||||
|
<span class="usa-sr-only">Error:</span>
|
||||||
|
{% if not safe_error_message %}{{ field.errors[0] }}{% else %}{{ field.errors[0]|safe }}{% endif %}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
{%
|
{%
|
||||||
if highlight_placeholders or autosize
|
if highlight_placeholders or autosize
|
||||||
%}
|
%}
|
||||||
@@ -59,6 +55,8 @@
|
|||||||
data_highlight_placeholders='true' if highlight_placeholders else 'false',
|
data_highlight_placeholders='true' if highlight_placeholders else 'false',
|
||||||
rows=rows|string,
|
rows=rows|string,
|
||||||
placeholder=placeholder,
|
placeholder=placeholder,
|
||||||
|
aria_describedby=field.name+"-error",
|
||||||
|
required='required' if required else None,
|
||||||
**kwargs
|
**kwargs
|
||||||
) }}
|
) }}
|
||||||
{% if suffix %}
|
{% if suffix %}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
<div class="tablet:grid-col-9 mobile-lg:grid-col-12">
|
<div class="tablet:grid-col-9 mobile-lg:grid-col-12">
|
||||||
{{ form.name(param_extensions={
|
{{ form.name(param_extensions={
|
||||||
"extra_form_group_classes": "margin-bottom-2",
|
"extra_form_group_classes": "margin-bottom-2",
|
||||||
|
"id": "name",
|
||||||
|
"required": True,
|
||||||
"hint": {"text": "Your recipients will not see this"}
|
"hint": {"text": "Your recipients will not see this"}
|
||||||
}) }}
|
}) }}
|
||||||
{{ textbox(
|
{{ textbox(
|
||||||
@@ -41,7 +43,8 @@
|
|||||||
hint=content_hint,
|
hint=content_hint,
|
||||||
rows=5,
|
rows=5,
|
||||||
extra_form_group_classes='margin-bottom-1',
|
extra_form_group_classes='margin-bottom-1',
|
||||||
placeholder='Edit me! Check out the Personalization section below for details on cool ((stuff)) you can do with your messages!'
|
placeholder='Edit me! Check out the Personalization section below for details on cool ((stuff)) you can do with your messages!',
|
||||||
|
required=True
|
||||||
) }}
|
) }}
|
||||||
{% if current_user.platform_admin %}
|
{% if current_user.platform_admin %}
|
||||||
{{ form.process_type }}
|
{{ form.process_type }}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
data_kwargs={'force-focus': True}
|
data_kwargs={'force-focus': True}
|
||||||
) %}
|
) %}
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-col-12 {% if form.placeholder_value.label.text == 'phone number' %}extra-tracking{% endif %}" aria-live="polite" role="alert">
|
<div class="grid-col-12 {% if form.placeholder_value.label.text == 'phone number' %}extra-tracking{% endif %}">
|
||||||
{{ form.placeholder_value(param_extensions={"classes": ""}) }}
|
{{ form.placeholder_value(param_extensions={"id": "phone-number"}) }}
|
||||||
</div>
|
</div>
|
||||||
{% if skip_link or link_to_upload %}
|
{% if skip_link or link_to_upload %}
|
||||||
<div class="grid-col-12 margin-top-1">
|
<div class="grid-col-12 margin-top-1">
|
||||||
|
|||||||
@@ -90,8 +90,4 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--<div class="">
|
|
||||||
{{ copy_to_clipboard(template.id, name="Template ID", thing='template ID') }}
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user