refactor application_review to use summary_item

This commit is contained in:
Rachid Mrad 2024-01-23 15:39:09 -05:00
parent 19c72b1858
commit 37c8c2b05e
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
3 changed files with 147 additions and 100 deletions

View file

@ -12,7 +12,7 @@
margin-top: units(1); margin-top: units(1);
} }
.register-form-step h3 { .register-form-step h3:not(.text-base-darker) {
color: color('primary-dark'); color: color('primary-dark');
letter-spacing: $letter-space--xs; letter-spacing: $letter-space--xs;
margin-top: units(3); margin-top: units(3);

View file

@ -20,113 +20,158 @@
{% block form_fields %} {% block form_fields %}
{% for step in steps.all|slice:":-1" %} {% for step in steps.all|slice:":-1" %}
<section class="review__step"> <section class="summary-item margin-top-3">
<hr />
<div class="review__step__title display-flex flex-justify">
<div class="review__step__value">
<div class="review__step__name">{{ form_titles|get_item:step }}</div>
<div>
{% if step == Step.ORGANIZATION_TYPE %} {% if step == Step.ORGANIZATION_TYPE %}
{% namespaced_url 'application' step as application_url %}
{% if application.organization_type is not None %} {% if application.organization_type is not None %}
{% with long_org_type=application.organization_type|get_organization_long_name %} {% with title=form_titles|get_item:step value=application.organization_type|get_organization_long_name|default:"Incomplete" %}
<p>{{ long_org_type }}</p> {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %} {% endwith %}
{% else %} {% else %}
<p>Incomplete</p> {% with title=form_titles|get_item:step value="Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if step == Step.TRIBAL_GOVERNMENT %} {% if step == Step.TRIBAL_GOVERNMENT %}
{{ application.tribe_name|default:"Incomplete" }} {% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.tribe_name|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% if application.federally_recognized_tribe %}<p>Federally-recognized tribe</p>{% endif %} {% if application.federally_recognized_tribe %}<p>Federally-recognized tribe</p>{% endif %}
{% if application.state_recognized_tribe %}<p>State-recognized tribe</p>{% endif %} {% if application.state_recognized_tribe %}<p>State-recognized tribe</p>{% endif %}
{% endif %} {% endif %}
{% if step == Step.ORGANIZATION_FEDERAL %} {% if step == Step.ORGANIZATION_FEDERAL %}
<p>{{ application.get_federal_type_display|default:"Incomplete" }}</p> {% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.get_federal_type_display|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
{% if step == Step.ORGANIZATION_ELECTION %} {% if step == Step.ORGANIZATION_ELECTION %}
<p>{{ application.is_election_board|yesno:"Yes,No,Incomplete" }}</p> {% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.is_election_board|yesno:"Yes,No,Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
{% if step == Step.ORGANIZATION_CONTACT %} {% if step == Step.ORGANIZATION_CONTACT %}
{% namespaced_url 'application' step as application_url %}
{% if application.organization_name %} {% if application.organization_name %}
{% include "includes/organization_address.html" with organization=application %} {% with title=form_titles|get_item:step value=application %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url address='true' %}
{% endwith %}
{% else %} {% else %}
<p>Incomplete</p> {% with title=form_titles|get_item:step value='Incomplete' %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if step == Step.ABOUT_YOUR_ORGANIZATION %} {% if step == Step.ABOUT_YOUR_ORGANIZATION %}
<p>{{ application.about_your_organization|default:"Incomplete" }}</p> {% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.about_your_organization|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
{% if step == Step.AUTHORIZING_OFFICIAL %} {% if step == Step.AUTHORIZING_OFFICIAL %}
{% if application.authorizing_official %} {% namespaced_url 'application' step as application_url %}
<div class="margin-bottom-105"> {% if application.authorizing_official is not None %}
{% include "includes/contact.html" with contact=application.authorizing_official %} {% with title=form_titles|get_item:step value=application.authorizing_official %}
</div> {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url contact='true' %}
{% endwith %}
{% else %} {% else %}
<p>Incomplete</p> {% with title=form_titles|get_item:step value="Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if step == Step.CURRENT_SITES %} {% if step == Step.CURRENT_SITES %}
<ul class="add-list-reset"> {% namespaced_url 'application' step as application_url %}
{% for site in application.current_websites.all %}
<li>{{ site.website }}</li>
{% empty %}
<li>None</li>
{% endfor %}
</ul>
{% endif %}
{% if step == Step.DOTGOV_DOMAIN %}
<ul class="add-list-reset margin-bottom-105">
<li>{{ application.requested_domain.name|default:"Incomplete" }}</li>
</ul>
{% if application.alternative_domains.all %} {% if application.alternative_domains.all %}
<div class="margin-bottom-105"> {% with title=form_titles|get_item:step value=application.current_websites.all %}
<p class="text-semibold margin-top-1 margin-bottom-0">Alternative domains</p> {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url list='true' %}
<ul class="add-list-reset"> {% endwith %}
{% else %}
{% with title=form_titles|get_item:step value='None' %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %}
{% endif %}
{% if step == Step.DOTGOV_DOMAIN %}
{% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.requested_domain.name|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% if application.alternative_domains.all %}
<h3 class="margin-bottom-0 text-base-darker">Alternative domains</h3>
<ul class="usa-list margin-top-0">
{% for site in application.alternative_domains.all %} {% for site in application.alternative_domains.all %}
<li>{{ site.website }}</li> <li>{{ site.website }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if step == Step.PURPOSE %} {% if step == Step.PURPOSE %}
<p>{{ application.purpose|default:"Incomplete" }}</p> {% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.purpose|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
{% if step == Step.YOUR_CONTACT %} {% if step == Step.YOUR_CONTACT %}
{% if application.submitter %} {% namespaced_url 'application' step as application_url %}
<div class="margin-bottom-105"> {% if application.submitter is not None %}
{% include "includes/contact.html" with contact=application.submitter %} {% with title=form_titles|get_item:step value=application.submitter %}
</div> {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url contact='true' %}
{% endwith %}
{% else %} {% else %}
<p>Incomplete</p> {% with title=form_titles|get_item:step value="Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if step == Step.OTHER_CONTACTS %} {% if step == Step.OTHER_CONTACTS %}
{% for other in application.other_contacts.all %} {% namespaced_url 'application' step as application_url %}
<div class="margin-bottom-105"> {% if application.other_contacts.all %}
<p class="text-semibold margin-top-1 margin-bottom-0">Contact {{ forloop.counter }}</p> {% with title=form_titles|get_item:step value=application.other_contacts.all %}
{% include "includes/contact.html" with contact=other %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url contact='true' list='true' %}
</div> {% endwith %}
{% empty %} {% else %}
<div class="margin-bottom-105"> {% with title=form_titles|get_item:step value=application.no_other_contacts_rationale|default:"Incomplete" %}
<p class="text-semibold margin-top-1 margin-bottom-0">No other employees from your organization?</p> {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
<p>{{ application.no_other_contacts_rationale|default:"Incomplete" }}</p> {% endwith %}
</div>
{% endfor %}
{% endif %} {% endif %}
{% endif %}
{% if step == Step.ANYTHING_ELSE %} {% if step == Step.ANYTHING_ELSE %}
<p>{{ application.anything_else|default:"No" }}</p> {% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.anything_else|default:"No" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
{% if step == Step.REQUIREMENTS %} {% if step == Step.REQUIREMENTS %}
<p>{{ application.is_policy_acknowledged|yesno:"I agree.,I do not agree.,I do not agree." }}</p> {% namespaced_url 'application' step as application_url %}
{% with title=form_titles|get_item:step value=application.is_policy_acknowledged|yesno:"I agree.,I do not agree.,I do not agree." %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=application_url %}
{% endwith %}
{% endif %} {% endif %}
</div>
</div>
<a
aria-describedby="review_step_title__{{step}}"
href="{% namespaced_url 'application' step %}"
>Edit<span class="sr-only"> {{ form_titles|get_item:step }}</span></a>
</div>
</section> </section>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}

View file

@ -31,8 +31,10 @@
<ul class="usa-list usa-list--unstyled margin-top-0"> <ul class="usa-list usa-list--unstyled margin-top-0">
{% for item in value %} {% for item in value %}
<li> <li>
<p class="text-semibold margin-top-1 margin-bottom-0"> <p class="margin-top-1 margin-bottom-0">
<strong>
Contact {{forloop.counter}} Contact {{forloop.counter}}
</strong>
</p> </p>
{% include "includes/contact.html" with contact=item %}</li> {% include "includes/contact.html" with contact=item %}</li>
{% empty %} {% empty %}