From 4d24f97ed76e72b8207e20fdcca002203da307d2 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Thu, 29 Aug 2019 13:33:17 -0400 Subject: [PATCH] Add optional label to text, options, phone, and multi-checkbox inputs Use new optional attribute on fields that are optional Update styling to fit optional label and update translations --- styles/elements/_inputs.scss | 3 +-- templates/components/multi_checkbox_input.html | 6 +++++- templates/components/options_input.html | 4 ++++ templates/components/text_input.html | 4 ++++ templates/fragments/edit_user_form.html | 6 +++--- templates/portfolios/admin.html | 2 +- templates/portfolios/applications/settings.html | 4 ++-- templates/portfolios/new.html | 2 +- translations.yaml | 2 +- 9 files changed, 22 insertions(+), 11 deletions(-) diff --git a/styles/elements/_inputs.scss b/styles/elements/_inputs.scss index 2845fe43..4ae5e2d3 100644 --- a/styles/elements/_inputs.scss +++ b/styles/elements/_inputs.scss @@ -378,8 +378,7 @@ select { margin-left: $gap * 4; .usa-input { - input, - label { + input { max-width: 12rem; } diff --git a/templates/components/multi_checkbox_input.html b/templates/components/multi_checkbox_input.html index 41fb23c3..fecfd5b8 100644 --- a/templates/components/multi_checkbox_input.html +++ b/templates/components/multi_checkbox_input.html @@ -1,7 +1,7 @@ {% from "components/icon.html" import Icon %} {% from "components/tooltip.html" import Tooltip %} -{% macro MultiCheckboxInput(field, other_input_field=None, tooltip=None, inline=False) -%} +{% macro MultiCheckboxInput(field, other_input_field=None, tooltip=None, inline=False, optional=True) -%}
{{ field.label | striptags}} + {% if optional %} +   + (optional) + {% endif %} {% if tooltip %}{{ Tooltip(tooltip) }}{% endif %} {% if not field.description %} {{ validation_icons }} diff --git a/templates/components/options_input.html b/templates/components/options_input.html index f5b98697..ca6a2610 100644 --- a/templates/components/options_input.html +++ b/templates/components/options_input.html @@ -28,6 +28,10 @@
{{ field.label | striptags}} + {% if optional %} +   + (optional) + {% endif %} {% if tooltip %}{{ Tooltip(tooltip) }}{% endif %}
diff --git a/templates/components/text_input.html b/templates/components/text_input.html index 9487abc2..042ba508 100644 --- a/templates/components/text_input.html +++ b/templates/components/text_input.html @@ -40,6 +40,10 @@