mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 10:46:06 +02:00
cleanup pt 2
This commit is contained in:
parent
a70d9d300d
commit
2c102f94d5
14 changed files with 78 additions and 87 deletions
|
@ -225,8 +225,3 @@ abbr[title] {
|
|||
.break-word {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.red-incomplete-text {
|
||||
color: $dhs-red-50;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ $dhs-red-90: #080102;
|
|||
$dhs-red-80: #37050d;
|
||||
$dhs-red-70: #660919;
|
||||
$dhs-red-60: #950e24;
|
||||
$dhs-red-50: #C41131;
|
||||
$dhs-red: #c41230;
|
||||
$dhs-red-40: #d24b62;
|
||||
$dhs-red-30: #e08493;
|
||||
|
|
|
@ -22,7 +22,7 @@ from registrar.views.report_views import (
|
|||
ExportDataTypeUser,
|
||||
)
|
||||
|
||||
from registrar.views.domain_request import Step
|
||||
from registrar.views.domain_request import DomainRequestStep
|
||||
from registrar.views.domain_requests_json import get_domain_requests_json
|
||||
from registrar.views.transfer_user import TransferUserView
|
||||
from registrar.views.utility.api_views import (
|
||||
|
@ -43,20 +43,20 @@ domain_request_urls = [
|
|||
# dynamically generate the other domain_request_urls
|
||||
for step, view in [
|
||||
# add/remove steps here
|
||||
(Step.ORGANIZATION_TYPE, views.OrganizationType),
|
||||
(Step.TRIBAL_GOVERNMENT, views.TribalGovernment),
|
||||
(Step.ORGANIZATION_FEDERAL, views.OrganizationFederal),
|
||||
(Step.ORGANIZATION_ELECTION, views.OrganizationElection),
|
||||
(Step.ORGANIZATION_CONTACT, views.OrganizationContact),
|
||||
(Step.ABOUT_YOUR_ORGANIZATION, views.AboutYourOrganization),
|
||||
(Step.SENIOR_OFFICIAL, views.SeniorOfficial),
|
||||
(Step.CURRENT_SITES, views.CurrentSites),
|
||||
(Step.DOTGOV_DOMAIN, views.DotgovDomain),
|
||||
(Step.PURPOSE, views.Purpose),
|
||||
(Step.OTHER_CONTACTS, views.OtherContacts),
|
||||
(Step.ADDITIONAL_DETAILS, views.AdditionalDetails),
|
||||
(Step.REQUIREMENTS, views.Requirements),
|
||||
(Step.REVIEW, views.Review),
|
||||
(DomainRequestStep.ORGANIZATION_TYPE, views.OrganizationType),
|
||||
(DomainRequestStep.TRIBAL_GOVERNMENT, views.TribalGovernment),
|
||||
(DomainRequestStep.ORGANIZATION_FEDERAL, views.OrganizationFederal),
|
||||
(DomainRequestStep.ORGANIZATION_ELECTION, views.OrganizationElection),
|
||||
(DomainRequestStep.ORGANIZATION_CONTACT, views.OrganizationContact),
|
||||
(DomainRequestStep.ABOUT_YOUR_ORGANIZATION, views.AboutYourOrganization),
|
||||
(DomainRequestStep.SENIOR_OFFICIAL, views.SeniorOfficial),
|
||||
(DomainRequestStep.CURRENT_SITES, views.CurrentSites),
|
||||
(DomainRequestStep.DOTGOV_DOMAIN, views.DotgovDomain),
|
||||
(DomainRequestStep.PURPOSE, views.Purpose),
|
||||
(DomainRequestStep.OTHER_CONTACTS, views.OtherContacts),
|
||||
(DomainRequestStep.ADDITIONAL_DETAILS, views.AdditionalDetails),
|
||||
(DomainRequestStep.REQUIREMENTS, views.Requirements),
|
||||
(DomainRequestStep.REVIEW, views.Review),
|
||||
]:
|
||||
domain_request_urls.append(path(f"{step}/", view.as_view(), name=step))
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ from itertools import zip_longest
|
|||
from typing import Callable
|
||||
from django.db.models.fields.related import ForeignObjectRel
|
||||
from django import forms
|
||||
from registrar.utility.enums import Step
|
||||
from registrar.utility.enums import DomainRequestStep
|
||||
from registrar.models import DomainRequest, Contact
|
||||
|
||||
|
||||
|
@ -283,7 +283,7 @@ class BaseYesNoForm(RegistrarForm):
|
|||
def request_step_list(request_wizard):
|
||||
"""Dynamically generated list of steps in the form wizard."""
|
||||
step_list = []
|
||||
for step in Step:
|
||||
for step in request_wizard.StepEnum:
|
||||
condition = request_wizard.WIZARD_CONDITIONS.get(step, True)
|
||||
if callable(condition):
|
||||
condition = condition(request_wizard)
|
||||
|
|
|
@ -1205,7 +1205,7 @@ class DomainRequest(TimeStampedModel):
|
|||
def _is_creator_complete(self):
|
||||
return self.creator is not None
|
||||
|
||||
def is_organization_name_and_address_complete(self):
|
||||
def _is_organization_name_and_address_complete(self):
|
||||
return not (
|
||||
self.organization_name is None
|
||||
and self.address_line1 is None
|
||||
|
@ -1273,7 +1273,7 @@ class DomainRequest(TimeStampedModel):
|
|||
def _is_general_form_complete(self, request):
|
||||
return (
|
||||
self._is_creator_complete()
|
||||
and self.is_organization_name_and_address_complete()
|
||||
and self._is_organization_name_and_address_complete()
|
||||
and self._is_senior_official_complete()
|
||||
and self._is_requested_domain_complete()
|
||||
and self._is_purpose_complete()
|
||||
|
|
|
@ -19,9 +19,12 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block form_fields %}
|
||||
{% include "includes/domain_request_review_steps.html" with is_editable=True %}
|
||||
{% comment %}
|
||||
TODO - uncomment
|
||||
{% if not portfolio %}
|
||||
{% include "includes/domain_request_review_steps.html" with is_editable=True %}
|
||||
{% else %}
|
||||
{% include "includes/portfolio_domain_request_review_steps.html" with is_editable=True %}
|
||||
{% endif %}
|
||||
{% endif %} {% endcomment %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
{% block title %}Domain request status | {{ DomainRequest.requested_domain.name }} | {% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% include "includes/domain_request_status_view.html" %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
{% if contact %}
|
||||
<address>
|
||||
{{ contact.get_formatted_name }}<br />
|
||||
{% if contact.title %}{{ contact.title }}<br />{% endif %}
|
||||
{% if contact.email %}{{ contact.email }}<br />{% endif %}
|
||||
{% if contact.phone %}{{ contact.phone.as_national }}{% endif %}
|
||||
</address>
|
||||
{% else %}
|
||||
{% if custom_text_for_value_none %}
|
||||
<p class="margin-top-0 margin-bottom-0 red-incomplete-text">
|
||||
{{ custom_text_for_value_none }}
|
||||
</p>
|
||||
{% else %}
|
||||
None
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{% if organization.is_organization_name_and_address_complete %}
|
||||
<address>
|
||||
{% if organization.federal_agency %}
|
||||
{{ organization.federal_agency }}<br />
|
||||
|
@ -27,12 +26,3 @@
|
|||
<br />{{ organization.urbanization }}
|
||||
{% endif %}
|
||||
</address>
|
||||
{% else %}
|
||||
{% if custom_text_for_value_none %}
|
||||
<p class="margin-top-0 margin-bottom-0 red-incomplete-text">
|
||||
{{ custom_text_for_value_none }}
|
||||
</p>
|
||||
{% else %}
|
||||
None
|
||||
{% endif %}
|
||||
{% endif %}
|
|
@ -2228,11 +2228,11 @@ class TestDomainRequestIncomplete(TestCase):
|
|||
|
||||
@less_console_noise_decorator
|
||||
def test_is_organization_name_and_address_complete(self):
|
||||
self.assertTrue(self.domain_request.is_organization_name_and_address_complete())
|
||||
self.assertTrue(self.domain_request._is_organization_name_and_address_complete())
|
||||
self.domain_request.organization_name = None
|
||||
self.domain_request.address_line1 = None
|
||||
self.domain_request.save()
|
||||
self.assertTrue(self.domain_request.is_organization_name_and_address_complete())
|
||||
self.assertTrue(self.domain_request._is_organization_name_and_address_complete())
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_is_senior_official_complete(self):
|
||||
|
|
|
@ -22,7 +22,7 @@ from registrar.models import (
|
|||
Portfolio,
|
||||
UserPortfolioPermission,
|
||||
)
|
||||
from registrar.views.domain_request import DomainRequestWizard, Step
|
||||
from registrar.views.domain_request import DomainRequestWizard, DomainRequestStep
|
||||
|
||||
from .common import less_console_noise
|
||||
from .test_views import TestWithUser
|
||||
|
@ -1098,7 +1098,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
contact_page = type_result.follow()
|
||||
|
||||
self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION])
|
||||
self.assertContains(contact_page, self.TITLES[DomainRequestStep.ABOUT_YOUR_ORGANIZATION])
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_federal_agency_dropdown_excludes_expected_values(self):
|
||||
|
@ -2327,7 +2327,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
contact_page = type_result.follow()
|
||||
|
||||
self.assertContains(contact_page, self.TITLES[Step.ABOUT_YOUR_ORGANIZATION])
|
||||
self.assertContains(contact_page, self.TITLES[DomainRequestStep.ABOUT_YOUR_ORGANIZATION])
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_domain_request_tribal_government(self):
|
||||
|
@ -2359,7 +2359,7 @@ class DomainRequestTests(TestWithUser, WebTest):
|
|||
tribal_government_page = type_result.follow()
|
||||
|
||||
# and the step is on the sidebar list.
|
||||
self.assertContains(tribal_government_page, self.TITLES[Step.TRIBAL_GOVERNMENT])
|
||||
self.assertContains(tribal_government_page, self.TITLES[DomainRequestStep.TRIBAL_GOVERNMENT])
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_domain_request_so_dynamic_text(self):
|
||||
|
|
|
@ -40,17 +40,13 @@ class DefaultEmail(Enum):
|
|||
LEGACY_DEFAULT = "registrar@dotgov.gov"
|
||||
|
||||
|
||||
class Step(StrEnum):
|
||||
class DomainRequestStep(StrEnum):
|
||||
"""
|
||||
Names for each page of the domain request wizard.
|
||||
|
||||
As with Django's own `TextChoices` class, steps will
|
||||
appear in the order they are defined. (Order matters.)
|
||||
"""
|
||||
# Portfolio
|
||||
# TODO - this does not exist yet.
|
||||
# Fill this in for the portfolio domain request experience.
|
||||
REQUESTING_ENTITY = "portfolio"
|
||||
|
||||
# Non-Portfolio
|
||||
ORGANIZATION_TYPE = "generic_org_type"
|
||||
|
@ -67,3 +63,20 @@ class Step(StrEnum):
|
|||
ADDITIONAL_DETAILS = "additional_details"
|
||||
REQUIREMENTS = "requirements"
|
||||
REVIEW = "review"
|
||||
|
||||
class PortfolioDomainRequestStep(StrEnum):
|
||||
"""
|
||||
Names for each page of the portfolio domain request wizard.
|
||||
|
||||
As with Django's own `TextChoices` class, steps will
|
||||
appear in the order they are defined. (Order matters.)
|
||||
"""
|
||||
# Portfolio
|
||||
# TODO - this does not exist yet.
|
||||
# Fill this in for the portfolio domain request experience.
|
||||
REQUESTING_ENTITY = "portfolio"
|
||||
CURRENT_SITES = "current_sites"
|
||||
DOTGOV_DOMAIN = "dotgov_domain"
|
||||
PURPOSE = "purpose"
|
||||
ADDITIONAL_DETAILS = "additional_details"
|
||||
REQUIREMENTS = "requirements"
|
||||
|
|
|
@ -14,7 +14,7 @@ from registrar.models.contact import Contact
|
|||
from registrar.models.user import User
|
||||
from registrar.views.utility import StepsHelper
|
||||
from registrar.views.utility.permission_views import DomainRequestPermissionDeleteView
|
||||
from registrar.utility.enums import Step
|
||||
from registrar.utility.enums import DomainRequestStep, PortfolioDomainRequestStep
|
||||
|
||||
from .utility import (
|
||||
DomainRequestPermissionView,
|
||||
|
@ -43,7 +43,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
Any method not marked as internal can be overridden in a subclass,
|
||||
although not without consulting the base implementation, first.
|
||||
"""
|
||||
|
||||
StepEnum = DomainRequestStep
|
||||
template_name = ""
|
||||
|
||||
# uniquely namespace the wizard in urls.py
|
||||
|
@ -56,29 +56,29 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
NEW_URL_NAME = "/request/"
|
||||
# We need to pass our human-readable step titles as context to the templates.
|
||||
TITLES = {
|
||||
Step.ORGANIZATION_TYPE: _("Type of organization"),
|
||||
Step.TRIBAL_GOVERNMENT: _("Tribal government"),
|
||||
Step.ORGANIZATION_FEDERAL: _("Federal government branch"),
|
||||
Step.ORGANIZATION_ELECTION: _("Election office"),
|
||||
Step.ORGANIZATION_CONTACT: _("Organization"),
|
||||
Step.ABOUT_YOUR_ORGANIZATION: _("About your organization"),
|
||||
Step.SENIOR_OFFICIAL: _("Senior official"),
|
||||
Step.CURRENT_SITES: _("Current websites"),
|
||||
Step.DOTGOV_DOMAIN: _(".gov domain"),
|
||||
Step.PURPOSE: _("Purpose of your domain"),
|
||||
Step.OTHER_CONTACTS: _("Other employees from your organization"),
|
||||
Step.ADDITIONAL_DETAILS: _("Additional details"),
|
||||
Step.REQUIREMENTS: _("Requirements for operating a .gov domain"),
|
||||
Step.REVIEW: _("Review and submit your domain request"),
|
||||
StepEnum.ORGANIZATION_TYPE: _("Type of organization"),
|
||||
StepEnum.TRIBAL_GOVERNMENT: _("Tribal government"),
|
||||
StepEnum.ORGANIZATION_FEDERAL: _("Federal government branch"),
|
||||
StepEnum.ORGANIZATION_ELECTION: _("Election office"),
|
||||
StepEnum.ORGANIZATION_CONTACT: _("Organization"),
|
||||
StepEnum.ABOUT_YOUR_ORGANIZATION: _("About your organization"),
|
||||
StepEnum.SENIOR_OFFICIAL: _("Senior official"),
|
||||
StepEnum.CURRENT_SITES: _("Current websites"),
|
||||
StepEnum.DOTGOV_DOMAIN: _(".gov domain"),
|
||||
StepEnum.PURPOSE: _("Purpose of your domain"),
|
||||
StepEnum.OTHER_CONTACTS: _("Other employees from your organization"),
|
||||
StepEnum.ADDITIONAL_DETAILS: _("Additional details"),
|
||||
StepEnum.REQUIREMENTS: _("Requirements for operating a .gov domain"),
|
||||
StepEnum.REVIEW: _("Review and submit your domain request"),
|
||||
}
|
||||
|
||||
# We can use a dictionary with step names and callables that return booleans
|
||||
# to show or hide particular steps based on the state of the process.
|
||||
WIZARD_CONDITIONS = {
|
||||
Step.ORGANIZATION_FEDERAL: lambda w: w.from_model("show_organization_federal", False),
|
||||
Step.TRIBAL_GOVERNMENT: lambda w: w.from_model("show_tribal_government", False),
|
||||
Step.ORGANIZATION_ELECTION: lambda w: w.from_model("show_organization_election", False),
|
||||
Step.ABOUT_YOUR_ORGANIZATION: lambda w: w.from_model("show_about_your_organization", False),
|
||||
StepEnum.ORGANIZATION_FEDERAL: lambda w: w.from_model("show_organization_federal", False),
|
||||
StepEnum.TRIBAL_GOVERNMENT: lambda w: w.from_model("show_tribal_government", False),
|
||||
StepEnum.ORGANIZATION_ELECTION: lambda w: w.from_model("show_organization_election", False),
|
||||
StepEnum.ABOUT_YOUR_ORGANIZATION: lambda w: w.from_model("show_about_your_organization", False),
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
|
@ -501,13 +501,15 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
|
||||
# TODO - this is a WIP until the domain request experience for portfolios is complete
|
||||
class PortfolioDomainRequestWizard(DomainRequestWizard):
|
||||
StepEnum = PortfolioDomainRequestStep
|
||||
|
||||
TITLES = {
|
||||
Step.REQUESTING_ENTITY: _("Requesting entity"),
|
||||
Step.CURRENT_SITES: _("Current websites"),
|
||||
Step.DOTGOV_DOMAIN: _(".gov domain"),
|
||||
Step.PURPOSE: _("Purpose of your domain"),
|
||||
Step.ADDITIONAL_DETAILS: _("Additional details"),
|
||||
Step.REQUIREMENTS: _("Requirements for operating a .gov domain"),
|
||||
StepEnum.REQUESTING_ENTITY: _("Requesting entity"),
|
||||
StepEnum.CURRENT_SITES: _("Current websites"),
|
||||
StepEnum.DOTGOV_DOMAIN: _(".gov domain"),
|
||||
StepEnum.PURPOSE: _("Purpose of your domain"),
|
||||
StepEnum.ADDITIONAL_DETAILS: _("Additional details"),
|
||||
StepEnum.REQUIREMENTS: _("Requirements for operating a .gov domain"),
|
||||
# Step.REVIEW: _("Review and submit your domain request"),
|
||||
}
|
||||
|
||||
|
@ -696,7 +698,7 @@ class Review(DomainRequestWizard):
|
|||
if DomainRequest._form_complete(self.domain_request, self.request) is False:
|
||||
logger.warning("User arrived at review page with an incomplete form.")
|
||||
context = super().get_context_data()
|
||||
context["Step"] = Step.__members__
|
||||
context["Step"] = DomainRequestStep.__members__
|
||||
context["domain_request"] = self.domain_request
|
||||
return context
|
||||
|
||||
|
@ -762,7 +764,7 @@ class DomainRequestStatusViewOnly(DomainRequestPortfolioViewonlyView):
|
|||
# Create a temp wizard object to grab the step list
|
||||
wizard = PortfolioDomainRequestWizard()
|
||||
wizard.request = self.request
|
||||
context["Step"] = Step.__members__
|
||||
context["Step"] = wizard.StepEnum.__members__
|
||||
context["steps"] = request_step_list(wizard)
|
||||
context["form_titles"] = wizard.TITLES
|
||||
return context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue