From 17f758bace0509270e93129913a67c43ad011c52 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Thu, 12 Dec 2024 18:42:03 -0800 Subject: [PATCH 01/62] added id and also refactor error message on templates page --- .../sass/uswds/_uswds-theme-custom-styles.scss | 4 ++++ app/templates/components/textbox.html | 18 +++++++----------- app/templates/views/edit-sms-template.html | 4 ++-- app/templates/views/send-test.html | 2 +- app/templates/views/templates/template.html | 4 ---- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss index 38ae4059fe..8b5dc96842 100644 --- a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss +++ b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss @@ -932,3 +932,7 @@ li.linked-card:hover svg, font-size: units(3); font-weight: bold; } + +.form-control-error { + border: 4px solid #b10e1e +} diff --git a/app/templates/components/textbox.html b/app/templates/components/textbox.html index 3e479cbceb..db3f27c648 100644 --- a/app/templates/components/textbox.html +++ b/app/templates/components/textbox.html @@ -16,19 +16,9 @@ placeholder='' ) %}
- {% if field.errors %} - - {% endif %}
{% endif %} + {% if field.errors %} + + {% if not safe_error_message %}{{ field.errors[0] }}{% else %}{{ field.errors[0]|safe }}{% endif %} + + {% endif %} + {% if highlight_placeholders or autosize %} diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index 97eac73dc9..f0129ef1c9 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -32,7 +32,7 @@
{{ form.name(param_extensions={ "extra_form_group_classes": "margin-bottom-2", - "hint": {"text": "Your recipients will not see this"} + "id": "template-name" }) }} {{ textbox( form.template_content, @@ -41,7 +41,7 @@ hint=content_hint, rows=5, 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!', ) }} {% if current_user.platform_admin %} {{ form.process_type }} diff --git a/app/templates/views/send-test.html b/app/templates/views/send-test.html index 8a4cf4c0d9..27bfe7965b 100644 --- a/app/templates/views/send-test.html +++ b/app/templates/views/send-test.html @@ -25,7 +25,7 @@ ) %}
- {{ form.placeholder_value(param_extensions={"classes": ""}) }} + {{ form.placeholder_value(param_extensions={"id": "phone-number"}) }}
{% if skip_link or link_to_upload %}
diff --git a/app/templates/views/templates/template.html b/app/templates/views/templates/template.html index f04f9f4907..00cd953031 100644 --- a/app/templates/views/templates/template.html +++ b/app/templates/views/templates/template.html @@ -88,8 +88,4 @@

More actions

- - {% endblock %} From b731cd62bbec88b0d0327c06d84fc4296433a0a0 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Thu, 12 Dec 2024 23:08:25 -0800 Subject: [PATCH 02/62] adding error annoucement --- app/main/views/templates.py | 1 + .../components/components/input/template.njk | 2 +- app/templates/components/textbox.html | 7 ++++--- app/templates/views/edit-sms-template.html | 13 +++++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 5c59e1e7cc..3a7315db7e 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -645,6 +645,7 @@ def edit_service_template(service_id, template_id): return render_template( "views/edit-{}-template.html".format(template["template_type"]), form=form, + errors=form.errors if form.errors else None, template=template, heading_action="Edit", ) diff --git a/app/templates/components/components/input/template.njk b/app/templates/components/components/input/template.njk index 7f56346517..f843f82b2c 100644 --- a/app/templates/components/components/input/template.njk +++ b/app/templates/components/components/input/template.njk @@ -5,7 +5,7 @@ {#- a record of other elements that we need to associate with the input using aria-describedby – for example hints or error messages -#} {% set describedBy = params.describedBy if params.describedBy else "" %} -
+