mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
Address feedback for unit tests
This commit is contained in:
commit
f0cea9f160
6 changed files with 111 additions and 43 deletions
|
@ -724,3 +724,15 @@ div.dja__model-description{
|
|||
.text-underline {
|
||||
text-decoration: underline !important;
|
||||
}
|
||||
|
||||
//-- Override some styling for the USWDS summary box (per design quidance for ticket #2055
|
||||
.usa-summary-box {
|
||||
background: #{$dhs-blue-10};
|
||||
border-color: #{$dhs-blue-30};
|
||||
max-width: 72ex;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.usa-summary-box h3 {
|
||||
color: #{$dhs-blue-60};
|
||||
}
|
||||
|
|
|
@ -988,9 +988,9 @@ class DomainRequest(TimeStampedModel):
|
|||
def _is_submitter_complete(self):
|
||||
return self.submitter is not None
|
||||
|
||||
def _is_other_contacts_complete(self):
|
||||
# If the object even exists and double check each part is filled out
|
||||
if (
|
||||
def _has_other_contacts_and_filled(self):
|
||||
# Other Contacts Radio button is Yes and if all required fields are filled
|
||||
return (
|
||||
self.has_other_contacts()
|
||||
and self.other_contacts.filter(
|
||||
first_name__isnull=False,
|
||||
|
@ -999,28 +999,33 @@ class DomainRequest(TimeStampedModel):
|
|||
email__isnull=False,
|
||||
phone__isnull=False,
|
||||
).exists()
|
||||
# Radio button is No + has rationale
|
||||
or (self.has_other_contacts() is False and self.no_other_contacts_rationale is not None)
|
||||
):
|
||||
)
|
||||
|
||||
def _has_no_other_contacts_gives_rationale(self):
|
||||
# Other Contacts Radio button is No and a rationale is provided
|
||||
return self.has_other_contacts() is False and self.no_other_contacts_rationale is not None
|
||||
|
||||
def _is_other_contacts_complete(self):
|
||||
if self._has_other_contacts_and_filled() or self._has_no_other_contacts_gives_rationale():
|
||||
return True
|
||||
return False
|
||||
|
||||
def _is_additional_details_complete(self):
|
||||
# has_cisa_representative is True and the cisa_representative_email is not empty and is not an empty string
|
||||
# OR has_cisa_representative is No
|
||||
# AND
|
||||
# the anything else boolean is True and there is text and it's not an empty string of text OR the boolean is No
|
||||
def _cisa_rep_and_email_check(self):
|
||||
# Has a CISA rep + email is NOT empty or NOT an empty string OR doesn't have CISA rep
|
||||
return (
|
||||
(
|
||||
self.has_cisa_representative is True
|
||||
and self.cisa_representative_email is not None
|
||||
and self.cisa_representative_email != ""
|
||||
)
|
||||
or self.has_cisa_representative is False
|
||||
) and (
|
||||
(self.has_anything_else_text is True and self.anything_else is not None and self.anything_else != "")
|
||||
or self.has_anything_else_text is False
|
||||
)
|
||||
) or self.has_cisa_representative is False
|
||||
|
||||
def _anything_else_radio_button_and_text_field_check(self):
|
||||
# Anything else boolean is True + filled text field and it's not an empty string OR the boolean is No
|
||||
return (
|
||||
self.has_anything_else_text is True and self.anything_else is not None and self.anything_else != ""
|
||||
) or self.has_anything_else_text is False
|
||||
|
||||
def _is_additional_details_complete(self):
|
||||
return self._cisa_rep_and_email_check() and self._anything_else_radio_button_and_text_field_check()
|
||||
|
||||
def _is_policy_acknowledgement_complete(self):
|
||||
return self.is_policy_acknowledged is not None
|
||||
|
@ -1038,22 +1043,23 @@ class DomainRequest(TimeStampedModel):
|
|||
)
|
||||
|
||||
def _form_complete(self):
|
||||
if self.generic_org_type == DomainRequest.OrganizationChoices.FEDERAL:
|
||||
match self.generic_org_type:
|
||||
case DomainRequest.OrganizationChoices.FEDERAL:
|
||||
is_complete = self._is_federal_complete()
|
||||
elif self.generic_org_type == DomainRequest.OrganizationChoices.INTERSTATE:
|
||||
case DomainRequest.OrganizationChoices.INTERSTATE:
|
||||
is_complete = self._is_interstate_complete()
|
||||
elif self.generic_org_type == DomainRequest.OrganizationChoices.STATE_OR_TERRITORY:
|
||||
case DomainRequest.OrganizationChoices.STATE_OR_TERRITORY:
|
||||
is_complete = self._is_state_or_territory_complete()
|
||||
elif self.generic_org_type == DomainRequest.OrganizationChoices.TRIBAL:
|
||||
case DomainRequest.OrganizationChoices.TRIBAL:
|
||||
is_complete = self._is_tribal_complete()
|
||||
elif self.generic_org_type == DomainRequest.OrganizationChoices.COUNTY:
|
||||
case DomainRequest.OrganizationChoices.COUNTY:
|
||||
is_complete = self._is_county_complete()
|
||||
elif self.generic_org_type == DomainRequest.OrganizationChoices.CITY:
|
||||
case DomainRequest.OrganizationChoices.CITY:
|
||||
is_complete = self._is_city_complete()
|
||||
elif self.generic_org_type == DomainRequest.OrganizationChoices.SPECIAL_DISTRICT:
|
||||
case DomainRequest.OrganizationChoices.SPECIAL_DISTRICT:
|
||||
is_complete = self._is_special_district_complete()
|
||||
else:
|
||||
# NOTE: This shouldn't happen, this is only if somehow they didn't choose an org type
|
||||
case _:
|
||||
# NOTE: Shouldn't happen, this is only if somehow they didn't choose an org type
|
||||
is_complete = False
|
||||
|
||||
if not is_complete or not self._is_general_form_complete():
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
<h2>Time to complete the form</h2>
|
||||
<p>If you have <a href="{% public_site_url 'domains/before/#information-you%E2%80%99ll-need-to-complete-the-domain-request-form' %}" target="_blank" class="usa-link">all the information you need</a>,
|
||||
completing your domain request might take around 15 minutes.</p>
|
||||
{% if has_profile_feature_flag %}
|
||||
<h2>How we’ll reach you</h2>
|
||||
<p>While reviewing your domain request, we may need to reach out with questions. We’ll also email you when we complete our review If the contact information below is not correct, visit <a href="" target="_blank" class="usa-link">your profile</a> to make updates.</p>
|
||||
{% include "includes/profile_information.html" with user=user%}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% block form_buttons %}
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
{% include "includes/summary_item.html" with title='Purpose of your domain' value=DomainRequest.purpose heading_level=heading_level %}
|
||||
{% endif %}
|
||||
|
||||
{% if DomainRequest.submitter %}
|
||||
{% if DomainRequest.submitter and not has_profile_feature_flag %}
|
||||
{% include "includes/summary_item.html" with title='Your contact information' value=DomainRequest.submitter contact='true' heading_level=heading_level %}
|
||||
{% endif %}
|
||||
|
||||
|
|
25
src/registrar/templates/includes/profile_information.html
Normal file
25
src/registrar/templates/includes/profile_information.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{% load static field_helpers %}
|
||||
|
||||
{% block domain_content %}
|
||||
|
||||
<div
|
||||
class="usa-summary-box"
|
||||
role="region"
|
||||
aria-labelledby="summary-box-key-information"
|
||||
>
|
||||
<div class="usa-summary-box__body">
|
||||
<h3 class="usa-summary-box__heading" id="summary-box-key-information">
|
||||
Your contact information
|
||||
</h3>
|
||||
<div class="usa-summary-box__text">
|
||||
<ul>
|
||||
<li>Full name: <b>{{ user.contact.get_formatted_name }}</b></li>
|
||||
<li>Organization email: <b>{{ user.email }}</b></li>
|
||||
<li>Title or role in your organization: <b>{{ user.contact.title }}</b></li>
|
||||
<li>Phone: <b>{{ user.contact.phone.as_national }}</b></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -22,7 +22,7 @@ from .utility import (
|
|||
DomainRequestWizardPermissionView,
|
||||
)
|
||||
|
||||
from waffle.decorators import flag_is_active
|
||||
from waffle.decorators import flag_is_active, waffle_flag
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -230,7 +230,8 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
context = self.get_context_data()
|
||||
if self.__class__ == DomainRequestWizard:
|
||||
if request.path_info == self.NEW_URL_NAME:
|
||||
return render(request, "domain_request_intro.html", context)
|
||||
context = self.get_context_data()
|
||||
return render(request, "domain_request_intro.html", context=context)
|
||||
else:
|
||||
return self.goto(self.steps.first)
|
||||
|
||||
|
@ -378,6 +379,8 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
|
||||
def get_context_data(self):
|
||||
"""Define context for access on all wizard pages."""
|
||||
has_profile_flag = flag_is_active(self.request, "profile_feature")
|
||||
logger.debug("PROFILE FLAG is %s" % has_profile_flag)
|
||||
|
||||
context_stuff = {}
|
||||
if DomainRequest._form_complete(self.domain_request):
|
||||
|
@ -393,9 +396,17 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
"modal_description": "Once you submit this request, you won’t be able to edit it until we review it.\
|
||||
You’ll only be able to withdraw your request.",
|
||||
"review_form_is_complete": True,
|
||||
"has_profile_feature_flag": flag_is_active(self.request, "profile_feature"),
|
||||
# Use the profile waffle feature flag to toggle profile features throughout domain requests
|
||||
"has_profile_feature_flag": has_profile_flag,
|
||||
"user": self.request.user,
|
||||
}
|
||||
else: # form is not complete
|
||||
# modal_button = '<button type="submit" ' 'class="usa-button" ' " data-close-modal onclick=window.location.href=window.location.origin' + '/request/review' data-close-modal>Return to request</button>"
|
||||
# modal_button = '<button type="submit" class="usa-button" data-close-modal formnovalidate onclick="this.closest(\'.usa-modal\').style.display=\'none\'">Return to request</button>'
|
||||
# modal_button = (
|
||||
# '<button type="submit" class="usa-button" data-close-modal formnovalidate '
|
||||
# 'onclick="this.closest(\'.usa-modal\').style.display=\'none\'" data-close-modal>Return to request</button>'
|
||||
# )
|
||||
modal_button = '<button type="submit" ' 'class="usa-button" ' " data-close-modal>Return to request</button>"
|
||||
context_stuff = {
|
||||
"form_titles": self.TITLES,
|
||||
|
@ -407,7 +418,8 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
"modal_description": "You can’t submit this request because it’s incomplete.\
|
||||
Click return to request and complete the sections that are missing information.",
|
||||
"review_form_is_complete": False,
|
||||
"has_profile_feature_flag": flag_is_active(self.request, "profile_feature"),
|
||||
"has_profile_feature_flag": has_profile_flag,
|
||||
"user": self.request.user,
|
||||
}
|
||||
return context_stuff
|
||||
|
||||
|
@ -420,6 +432,10 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
condition = condition(self)
|
||||
if condition:
|
||||
step_list.append(step)
|
||||
|
||||
if flag_is_active(self.request, "profile_feature"):
|
||||
step_list.remove(Step.YOUR_CONTACT)
|
||||
|
||||
return step_list
|
||||
|
||||
def goto(self, step):
|
||||
|
@ -554,6 +570,10 @@ class YourContact(DomainRequestWizard):
|
|||
template_name = "domain_request_your_contact.html"
|
||||
forms = [forms.YourContactForm]
|
||||
|
||||
@waffle_flag("!profile_feature") # type: ignore
|
||||
def dispatch(self, request, *args, **kwargs): # type: ignore
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
class OtherContacts(DomainRequestWizard):
|
||||
template_name = "domain_request_other_contacts.html"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue