From 4085c42c1cde60121f31a580eac334315672da1e Mon Sep 17 00:00:00 2001 From: richard-dds Date: Tue, 14 Aug 2018 17:26:21 -0400 Subject: [PATCH] WIP --- atst/forms/poc.py | 7 ++--- templates/components/checkbox_input.html | 37 ++++++++++++++++++++++++ templates/requests/screen-3.html | 3 +- 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 templates/components/checkbox_input.html diff --git a/atst/forms/poc.py b/atst/forms/poc.py index 358f9de2..b036cdc2 100644 --- a/atst/forms/poc.py +++ b/atst/forms/poc.py @@ -1,4 +1,4 @@ -from wtforms.fields import StringField, RadioField +from wtforms.fields import StringField, BooleanField from wtforms.fields.html5 import EmailField from wtforms.validators import Required, Email, Length, Optional from .forms import ValidatedForm @@ -19,11 +19,10 @@ class POCForm(ValidatedForm): return super().validate(*args, **kwargs) - am_poc = RadioField( + am_poc = BooleanField( "I am the technical POC.", - choices=[("yes", "Yes"), ("no", "No")], - default="no", validators=[Required()], + default=False ) fname_poc = StringField("POC First Name", validators=[Required()]) diff --git a/templates/components/checkbox_input.html b/templates/components/checkbox_input.html new file mode 100644 index 00000000..34c9a0da --- /dev/null +++ b/templates/components/checkbox_input.html @@ -0,0 +1,37 @@ +{% from "components/icon.html" import Icon %} +{% from "components/tooltip.html" import Tooltip %} + +{% macro OptionsInput(field, tooltip, inline=False) -%} + +
+ +
+ +
+ {{ field.label | striptags}} + {% if tooltip %}{{ Tooltip(tooltip) }}{% endif %} +
+ + {% if field.description %} + {{ field.description | safe }} + {% endif %} + + {% if field.errors %} + {{ Icon('alert',classes="icon-validation") }} + {% endif %} +
+ + {{ field() }} + + {% if field.errors %} + {% for error in field.errors %} + {{ error }} + {% endfor %} + {% endif %} + +
+
+ +
+ +{%- endmacro %} diff --git a/templates/requests/screen-3.html b/templates/requests/screen-3.html index f54460e2..1a469df6 100644 --- a/templates/requests/screen-3.html +++ b/templates/requests/screen-3.html @@ -31,7 +31,8 @@ This POC may be you.

- {{ OptionsInput(f.am_poc) }} + {{ f.am_poc() }} + {{ f.am_poc.label }}