Better form templates

This commit is contained in:
Neil Martinsen-Burrell 2022-10-19 09:59:04 -05:00
parent c56914f2e1
commit 5766a0bf9f
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
3 changed files with 41 additions and 24 deletions

View file

@ -10,8 +10,24 @@
<h2> What kind of government organization do you represent?</h2>
<form action="" method="post">{% csrf_token %}
{{ wizard.management_form }}
{{ wizard.form }}
<form class="usa-form usa-form--large" method="post">
{{ wizard.management_form }}
{% csrf_token %}
<fieldset class="usa-fieldset">
<p>
Required fields are marked with an asterisk (<abbr
title="required"
class="usa-hint usa-hint--required"
>*</abbr>).
</p>
{% for field in wizard.form %}
<label class="usa-label" for="id_{{ field.name }}">{{ field.label }}</label>
{{ field }}
{% endfor %}
</fieldset>
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" class="usa-button usa-button--base" value="{{ wizard.steps.prev }}">Previous</button>
{% endif %}
<button name="wizard_goto_step" type="submit" class="usa-button" value="{{ wizard.steps.prev }}">Next</button>
</form>
{% endblock %}

View file

@ -15,12 +15,10 @@
<li> You need to have the approval within your organization to make this request</li>
</ol>
<form action="" method="post">{% csrf_token %}
{{ wizard.management_form }}
<form class="usa-form usa-form--large" method="post" enctype="multipart/form-data">
<form class="usa-form usa-form--large" method="post">
{{ wizard.management_form }}
{% csrf_token %}
<fieldset class="usa-fieldset">
<legend class="usa-legend usa-legend--large">Your profile</legend>
<p>
Required fields are marked with an asterisk (<abbr
title="required"
@ -28,11 +26,14 @@
>*</abbr
>).
</p>
{% for field in wizard.form %}
<label class="usa-label" for="id_{{ field.name }}">{{ field.label }}</label>
{{ field }}
{% for field in wizard.form %}
<label class="usa-label" for="id_{{ field.name }}">{{ field.label }}</label>
{{ field }}
{% endfor %}
</fieldset>
<button type="submit" class="usa-button usa-button--big">Save Changes</button>
</fieldset>
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" class="usa-button usa-button--base" value="{{ wizard.steps.prev }}">Previous</button>
{% endif %}
<button name="wizard_goto_step" type="submit" class="usa-button" value="{{ wizard.steps.prev }}">Next</button>
</form>
{% endblock %}

View file

@ -1,18 +1,18 @@
<div class="tablet:grid-col-4 margin-bottom-4 tablet:margin-bottom-0">
<nav aria-label="Form steps,">
<ul class="usa-sidenav">
{% for this_step in wizard.steps.all %}
<li class="usa-sidenav__item">
{% if forloop.counter <= wizard.step1 %}
<a href="{% url wizard.url_name step=this_step %}"
{% if this_step == wizard.steps.current %}class="usa-current"{% endif%}>
{{ this_step }} {{ forloop.counter }} {{ wizard.step1 }}
</a>
{% else %}
{{ this_step }} {{ forloop.counter }} {{ wizard.step1 }}
{% endif %}
</li>
{% endfor %}
{% for this_step in wizard.steps.all %}
<li class="usa-sidenav__item">
{% if forloop.counter <= wizard.steps.step1 %}
<a href="{% url wizard.url_name step=this_step %}"
{% if this_step == wizard.steps.current %}class="usa-current"{% endif%}>
{{ this_step }}
</a>
{% else %}
{{ this_step }}
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
</div>