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> <h2> What kind of government organization do you represent?</h2>
<form action="" method="post">{% csrf_token %} <form class="usa-form usa-form--large" method="post">
{{ wizard.management_form }} {{ wizard.management_form }}
{{ wizard.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> </form>
{% endblock %} {% endblock %}

View file

@ -15,12 +15,10 @@
<li> You need to have the approval within your organization to make this request</li> <li> You need to have the approval within your organization to make this request</li>
</ol> </ol>
<form action="" method="post">{% csrf_token %} <form class="usa-form usa-form--large" method="post">
{{ wizard.management_form }} {{ wizard.management_form }}
<form class="usa-form usa-form--large" method="post" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
<fieldset class="usa-fieldset"> <fieldset class="usa-fieldset">
<legend class="usa-legend usa-legend--large">Your profile</legend>
<p> <p>
Required fields are marked with an asterisk (<abbr Required fields are marked with an asterisk (<abbr
title="required" title="required"
@ -33,6 +31,9 @@
{{ field }} {{ field }}
{% endfor %} {% endfor %}
</fieldset> </fieldset>
<button type="submit" class="usa-button usa-button--big">Save Changes</button> {% 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> </form>
{% endblock %} {% endblock %}

View file

@ -3,13 +3,13 @@
<ul class="usa-sidenav"> <ul class="usa-sidenav">
{% for this_step in wizard.steps.all %} {% for this_step in wizard.steps.all %}
<li class="usa-sidenav__item"> <li class="usa-sidenav__item">
{% if forloop.counter <= wizard.step1 %} {% if forloop.counter <= wizard.steps.step1 %}
<a href="{% url wizard.url_name step=this_step %}" <a href="{% url wizard.url_name step=this_step %}"
{% if this_step == wizard.steps.current %}class="usa-current"{% endif%}> {% if this_step == wizard.steps.current %}class="usa-current"{% endif%}>
{{ this_step }} {{ forloop.counter }} {{ wizard.step1 }} {{ this_step }}
</a> </a>
{% else %} {% else %}
{{ this_step }} {{ forloop.counter }} {{ wizard.step1 }} {{ this_step }}
{% endif %} {% endif %}
</li> </li>
{% endfor %} {% endfor %}