Move organization type sub questions to own pages

This commit is contained in:
igorkorenfeld 2022-11-10 16:13:43 -05:00
parent 33cf8feb29
commit e1a1a5e367
No known key found for this signature in database
GPG key ID: 826947A4B867F659
4 changed files with 69 additions and 32 deletions

View file

@ -64,6 +64,26 @@ class OrganizationForm(RegistrarForm):
widget=forms.RadioSelect(attrs={"class":"usa-radio__input"}),
)
class OrganizationFederalForm(RegistrarForm):
federal_type = forms.ChoiceField(
required=False,
choices=[
("Executive", "Executive"),
("Judicial", "Judicial"),
("Legislative", "Legislative"),
],
widget=forms.RadioSelect,
)
class OrganizationElectionForm(RegistrarForm):
is_election_board = forms.ChoiceField(
required=False,
choices=[
("Yes", "Yes"),
("No", "No"),
],
widget=forms.RadioSelect(),
)
class OrgContactForm(RegistrarForm):
organization_name = forms.CharField(label="Organization Name")
@ -149,6 +169,8 @@ class ReviewForm(RegistrarForm):
# subclass
FORMS = [
("organization", OrganizationForm),
("organization_federal", OrganizationFederalForm),
("organization_election", OrganizationElectionForm),
("org_contact", OrgContactForm),
("authorizing_official", AuthorizingOfficialForm),
("current_sites", CurrentSitesForm),
@ -166,6 +188,8 @@ FORMS = [
# match the first elements of the tuples in FORMS
TEMPLATES = {
"organization": "application_organization.html",
"organization_federal": "application_org_federal.html",
"organization_election": "application_org_election.html",
"org_contact": "application_org_contact.html",
"authorizing_official": "application_authorizing_official.html",
"current_sites": "application_current_sites.html",
@ -183,6 +207,8 @@ TEMPLATES = {
# by the step names
TITLES = {
"organization": "Type of organization",
"organization_federal": "Type of organization — Federal",
"organization_election": "Type of organization — Election board",
"org_contact": "Organization name and mailing address",
"authorizing_official": "Authorizing official",
"current_sites": "Organization website",

View file

@ -0,0 +1,21 @@
<!-- Test page -->
{% extends 'application_form.html' %}
{% load widget_tweaks %}
{% load dynamic_question_tags %}
{% block form_content %}
<form id="step__{{wizard.steps.current}}" class="usa-form usa-form--large" method="post">
{{ wizard.management_form }}
{% csrf_token %}
<h2>Is your organization an election office?</h2>
<fieldset id="election_board__fieldset" class="usa-fieldset">
{% radio_buttons_by_value wizard.form.is_election_board as choices %}
{% include "includes/radio_button.html" with choice=choices.Yes%}
{% include "includes/radio_button.html" with choice=choices.No%}
</fieldset>
{{ block.super }}
</form>
{% endblock %}

View file

@ -0,0 +1,22 @@
<!-- Test page -->
{% extends 'application_form.html' %}
{% load widget_tweaks %}
{% load dynamic_question_tags %}
{% block form_content %}
<form id="step__{{wizard.steps.current}}" class="usa-form usa-form--large" method="post">
{{ wizard.management_form }}
{% csrf_token %}
<h2>Which federal branch is your organization in?</h2>
<fieldset id="federal_type__fieldset" class="usa-fieldset">
{% radio_buttons_by_value wizard.form.federal_type as federal_choices %}
{% include "includes/radio_button.html" with choice=federal_choices.Executive%}
{% include "includes/radio_button.html" with choice=federal_choices.Judicial%}
{% include "includes/radio_button.html" with choice=federal_choices.Legislative%}
</fieldset>
{{ block.super }}
</form>
{% endblock %}

View file

@ -25,38 +25,6 @@
{% include "includes/radio_button.html" with choice=choices.Special_District tile="true" %}
</fieldset>
<fieldset id="federal_type__fieldset" {% trigger wizard.form.federal_type choices.Federal %} class="usa-fieldset">
<legend class="usa-legend">
<h2> Which federal branch does your organization belong to?</h2>
</legend>
<noscript>
Only required if you selected "Federal".
</noscript>
{% radio_buttons_by_value wizard.form.federal_type as federal_choices %}
{% include "includes/radio_button.html" with choice=federal_choices.Executive%}
{% include "includes/radio_button.html" with choice=federal_choices.Judicial%}
{% include "includes/radio_button.html" with choice=federal_choices.Legislative%}
</fieldset>
<fieldset id="is_election_board__fieldset" {% trigger wizard.form.is_election_board choices.Tribal choices.County choices.City choices.Special_District%} class="usa-fieldset">
<legend class="usa-legend">
<h2> Is your organization an election office?</h2>
</legend>
<noscript>
Only required if you selected "Tribal", "County", "City" or "Special District".
</noscript>
{% for radio in wizard.form.is_election_board %}
<div class="usa-radio">
{{radio.tag}}
<label for="{{radio.id_for_label}}" class="usa-radio__label">
{{ radio.choice_label }}
</label>
</div>
{% endfor %}
<!-- {{ wizard.form.is_election_board|add_label_class:"usa-label" }} -->
<!-- {{ wizard.form.is_election_board|add_class:"usa-radio" }} -->
</fieldset>
{{ block.super }}
</form>