Merge main with 2594

This commit is contained in:
Rachid Mrad 2024-11-26 12:47:53 -05:00
commit da56e86dd0
No known key found for this signature in database
19 changed files with 69 additions and 54 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -30,15 +30,15 @@ body {
padding-bottom: units(6) * 2 ; //Workaround because USWDS units jump from 10 to 15 padding-bottom: units(6) * 2 ; //Workaround because USWDS units jump from 10 to 15
} }
#wrapper.wrapper--padding-top-6 {
padding-top: units(6);
}
#wrapper.dashboard { #wrapper.dashboard {
background-color: color('primary-lightest'); background-color: color('primary-lightest');
padding-top: units(5)!important; padding-top: units(5)!important;
} }
#wrapper.dashboard--portfolio {
padding-top: units(4)!important;
}
#wrapper.dashboard--grey-1 { #wrapper.dashboard--grey-1 {
background-color: color('gray-1'); background-color: color('gray-1');
} }

View file

@ -363,7 +363,6 @@ CSP_DEFAULT_SRC = ("'self'",)
CSP_STYLE_SRC = [ CSP_STYLE_SRC = [
"'self'", "'self'",
"https://www.ssa.gov/accessibility/andi/andi.css", "https://www.ssa.gov/accessibility/andi/andi.css",
"https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css",
] ]
CSP_SCRIPT_SRC_ELEM = [ CSP_SCRIPT_SRC_ELEM = [
"'self'", "'self'",
@ -371,7 +370,6 @@ CSP_SCRIPT_SRC_ELEM = [
"https://cdn.jsdelivr.net/npm/chart.js", "https://cdn.jsdelivr.net/npm/chart.js",
"https://www.ssa.gov", "https://www.ssa.gov",
"https://ajax.googleapis.com", "https://ajax.googleapis.com",
"https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js",
] ]
CSP_CONNECT_SRC = ["'self'", "https://www.google-analytics.com/", "https://www.ssa.gov/accessibility/andi/andi.js"] CSP_CONNECT_SRC = ["'self'", "https://www.google-analytics.com/", "https://www.ssa.gov/accessibility/andi/andi.js"]
CSP_INCLUDE_NONCE_IN = ["script-src-elem", "style-src"] CSP_INCLUDE_NONCE_IN = ["script-src-elem", "style-src"]

View file

@ -97,5 +97,19 @@ def portfolio_permissions(request):
def is_widescreen_mode(request): def is_widescreen_mode(request):
widescreen_paths = ["/domains/", "/requests/", "/members/"] widescreen_paths = []
return {"is_widescreen_mode": any(path in request.path for path in widescreen_paths) or request.path == "/"} portfolio_widescreen_paths = [
"/domains/",
"/requests/",
"/request/",
"/no-organization-requests/",
"/no-organization-domains/",
"/domain-request/",
]
is_widescreen = any(path in request.path for path in widescreen_paths) or request.path == "/"
is_portfolio_widescreen = bool(
hasattr(request.user, "is_org_user")
and request.user.is_org_user(request)
and any(path in request.path for path in portfolio_widescreen_paths)
)
return {"is_widescreen_mode": is_widescreen or is_portfolio_widescreen}

View file

@ -115,11 +115,14 @@ class RequestingEntityForm(RegistrarForm):
if is_requesting_new_suborganization: if is_requesting_new_suborganization:
# Validate custom suborganization fields # Validate custom suborganization fields
if not cleaned_data.get("requested_suborganization"): if not cleaned_data.get("requested_suborganization"):
self.add_error("requested_suborganization", "Requested suborganization is required.") self.add_error("requested_suborganization", "Enter the name of your suborganization.")
if not cleaned_data.get("suborganization_city"): if not cleaned_data.get("suborganization_city"):
self.add_error("suborganization_city", "City is required.") self.add_error("suborganization_city", "Enter the city where your suborganization is located.")
if not cleaned_data.get("suborganization_state_territory"): if not cleaned_data.get("suborganization_state_territory"):
self.add_error("suborganization_state_territory", "State, territory, or military post is required.") self.add_error(
"suborganization_state_territory",
"Select the state, territory, or military post where your suborganization is located.",
)
elif not suborganization: elif not suborganization:
self.add_error("sub_organization", "Suborganization is required.") self.add_error("sub_organization", "Suborganization is required.")

View file

@ -16,10 +16,10 @@
<script src="{% static 'admin/js/vendor/jquery/jquery.min.js' %}"></script> <script src="{% static 'admin/js/vendor/jquery/jquery.min.js' %}"></script>
<!-- Include Select2 JavaScript. Since this view technically falls outside of admin, this is needed. --> <!-- Include Select2 JavaScript. Since this view technically falls outside of admin, this is needed. -->
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <script src="{% static 'js/select2.min.js' %}"></script>
<script type="application/javascript" src="{% static 'js/get-gov-admin-extra.js' %}" defer></script> <script type="application/javascript" src="{% static 'js/get-gov-admin-extra.js' %}" defer></script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <link href="{% static 'css/select2.min.css' %}" rel="stylesheet" />
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}

View file

@ -158,7 +158,9 @@
{% endblock header %} {% endblock header %}
{% block wrapper %} {% block wrapper %}
{% block wrapperdiv %}
<div id="wrapper"> <div id="wrapper">
{% endblock wrapperdiv %}
{% block messages %} {% block messages %}
{% if messages %} {% if messages %}
<ul class="messages"> <ul class="messages">

View file

@ -4,6 +4,12 @@
{% block title %}Thanks for your domain request! | {% endblock %} {% block title %}Thanks for your domain request! | {% endblock %}
{% comment %} Same as the old wrapper implementation but with padding-top-4 {% endcomment %}
{% block wrapperdiv %}
<div id="wrapper" class="wrapper--padding-top-6">
{% endblock wrapperdiv %}
{% block content %} {% block content %}
<main id="main-content" class="grid-container register-form-step"> <main id="main-content" class="grid-container register-form-step">
<span class="display-flex flex-align-center" > <span class="display-flex flex-align-center" >
@ -28,8 +34,8 @@
<li>Your requested domain meets our naming requirements.</li> <li>Your requested domain meets our naming requirements.</li>
</ul> </ul>
<p> Well email you if we have questions. Well also email you as soon as we complete our review. You can <a href="{% url 'home' %}">check the status</a> <p> Well email you if we have questions. Well also email you as soon as we complete our review. You can <a href="{% if portfolio %}{% url 'domain-requests' %}{% else %}{% url 'home' %}{% endif %}">check the status</a>
of your request at any time on the registrar homepage.</p> of your request at any time on the registrar.</p>
<p> <a class="usa-link" rel="noopener noreferrer" target="_blank" href="{% public_site_url 'contact' %}">Contact us if you need help during this process</a>.</p> <p> <a class="usa-link" rel="noopener noreferrer" target="_blank" href="{% public_site_url 'contact' %}">Contact us if you need help during this process</a>.</p>

View file

@ -2,11 +2,12 @@
{% load field_helpers url_helpers %} {% load field_helpers url_helpers %}
{% block form_instructions %} {% block form_instructions %}
<p>To help with our review, we need to understand whether the domain you're requesting will be used by the Department of Energy or by one of its suborganizations.</p> <p>To help with our review, we need to understand whether the domain you're requesting will be used by {{ portfolio }} or by one of its suborganizations.</p>
<p>We define a suborganization as any entity (agency, bureau, office) that falls under the overarching organization.</p> <p>We define a suborganization as any entity (agency, bureau, office) that falls under the overarching organization.</p>
{% endblock %} {% endblock %}
{% block form_fields %} {% block form_fields %}
<input id="option-to-add-suborg" value="Other (enter your suborganization manually)"/>
<fieldset class="usa-fieldset"> <fieldset class="usa-fieldset">
<legend> <legend>
<h2>Who will use the domain youre requesting?</h2> <h2>Who will use the domain youre requesting?</h2>
@ -33,8 +34,8 @@
<div id="suborganization-container" class="margin-top-4"> <div id="suborganization-container" class="margin-top-4">
<h2>Add suborganization information</h2> <h2>Add suborganization information</h2>
<p> <p>
This information will be published in <a class="usa-link usa-link--always-blue" href="{% public_site_url 'about/data' %}">.govs public data</a>. If you dont see your suborganization in the list, This information will be published in <a class="usa-link usa-link--always-blue" target="_blank" href="{% public_site_url 'about/data' %}">.govs public data</a>. If you dont see your suborganization in the list,
select “other” and enter the name or your suborganization. select “other.
</p> </p>
{% with attr_required=True %} {% with attr_required=True %}
{% input_with_errors forms.1.sub_organization %} {% input_with_errors forms.1.sub_organization %}
@ -43,7 +44,7 @@
{% comment %} This will be toggled if a special value, "other", is selected. {% comment %} This will be toggled if a special value, "other", is selected.
Otherwise this field is invisible. Otherwise this field is invisible.
{% endcomment %} {% endcomment %}
<div id="suborganization-container__details"> <div id="suborganization-container__details" class="padding-top-2 margin-top-0">
{% with attr_required=True %} {% with attr_required=True %}
{% input_with_errors forms.1.requested_suborganization %} {% input_with_errors forms.1.requested_suborganization %}
{% endwith %} {% endwith %}

View file

@ -3,6 +3,10 @@
{% block title %}Withdraw request for {{ DomainRequest.requested_domain.name }} | {% endblock %} {% block title %}Withdraw request for {{ DomainRequest.requested_domain.name }} | {% endblock %}
{% load static url_helpers %} {% load static url_helpers %}
{% block wrapperdiv %}
<div id="wrapper" class="wrapper--padding-top-6">
{% endblock wrapperdiv %}
{% block content %} {% block content %}
<div class="grid-container"> <div class="grid-container">
<div class="grid-col desktop:grid-offset-2 desktop:grid-col-8"> <div class="grid-col desktop:grid-offset-2 desktop:grid-col-8">

View file

@ -34,7 +34,6 @@
</ul> </ul>
</div> </div>
<ul class="usa-nav__primary usa-accordion"> <ul class="usa-nav__primary usa-accordion">
{% if not hide_domains %}
<li class="usa-nav__primary-item"> <li class="usa-nav__primary-item">
{% if has_any_domains_portfolio_permission %} {% if has_any_domains_portfolio_permission %}
{% url 'domains' as url %} {% url 'domains' as url %}
@ -45,14 +44,13 @@
Domains Domains
</a> </a>
</li> </li>
{% endif %}
<!-- <li class="usa-nav__primary-item"> <!-- <li class="usa-nav__primary-item">
<a href="#" class="usa-nav-link"> <a href="#" class="usa-nav-link">
Domain groups Domain groups
</a> </a>
</li> --> </li> -->
{% if has_organization_requests_flag and not hide_requests %} {% if has_organization_requests_flag %}
<li class="usa-nav__primary-item"> <li class="usa-nav__primary-item">
<!-- user has one of the view permissions plus the edit permission, show the dropdown --> <!-- user has one of the view permissions plus the edit permission, show the dropdown -->
{% if has_edit_request_portfolio_permission %} {% if has_edit_request_portfolio_permission %}
@ -93,7 +91,7 @@
</li> </li>
{% endif %} {% endif %}
{% if has_organization_members_flag and not hide_members %} {% if has_organization_members_flag %}
<li class="usa-nav__primary-item"> <li class="usa-nav__primary-item">
<a href="{% url 'members' %}" class="usa-nav-link {% if path|is_members_subpage %} usa-current{% endif %}"> <a href="{% url 'members' %}" class="usa-nav-link {% if path|is_members_subpage %} usa-current{% endif %}">
Members Members

View file

@ -1,7 +1,7 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block wrapper %} {% block wrapper %}
<div id="wrapper" class="{% block wrapper_class %}dashboard--portfolio{% endblock %}"> <div id="wrapper" class="{% block wrapper_class %}wrapper--padding-top-6{% endblock %}">
{% block content %} {% block content %}
<main class="grid-container {% if is_widescreen_mode %} grid-container--widescreen {% endif %}"> <main class="grid-container {% if is_widescreen_mode %} grid-container--widescreen {% endif %}">

View file

@ -18,7 +18,7 @@
<h2 id="domains-header" class="display-inline-block">You arent managing any domains.</h2> <h2 id="domains-header" class="display-inline-block">You arent managing any domains.</h2>
{% if portfolio_administrators %} {% if portfolio_administrators %}
<p>If you believe you should have access to a domain, reach out to your organizations administrators.</p> <p>If you believe you should have access to a domain, reach out to your organizations administrators.</p>
<p>Your organizations administrators:</p> <p>Your organization's administrators:</p>
<ul class="margin-top-0"> <ul class="margin-top-0">
{% for administrator in portfolio_administrators %} {% for administrator in portfolio_administrators %}
{% if administrator.email %} {% if administrator.email %}

View file

@ -5,13 +5,13 @@
{% block title %} Domain Requests | {% endblock %} {% block title %} Domain Requests | {% endblock %}
{% block portfolio_content %} {% block portfolio_content %}
<h1 id="domains-header">Current domain requests</h1> <h1 id="domains-header">Domain requests</h1>
<section class="section-outlined"> <section class="section-outlined">
<div class="section-outlined__header margin-bottom-3"> <div class="section-outlined__header margin-bottom-3">
<h2 id="domains-header" class="display-inline-block">You dont have access to domain requests.</h2> <h2 id="domains-header" class="display-inline-block">You dont have access to domain requests.</h2>
{% if portfolio_administrators %} {% if portfolio_administrators %}
<p>If you believe you should have access to a request, reach out to your organizations administrators.</p> <p>If you believe you should have access to requests, reach out to your organizations administrators.</p>
<p>Your organizations administrators:</p> <p>Your organization's administrators:</p>
<ul class="margin-top-0"> <ul class="margin-top-0">
{% for administrator in portfolio_administrators %} {% for administrator in portfolio_administrators %}
{% if administrator.email %} {% if administrator.email %}

View file

@ -14,12 +14,12 @@
{% endblock %} {% endblock %}
<div id="main-content"> <div id="main-content">
<h1 id="domain-requests-header">Domain requests</h1> <h1 id="domain-requests-header" class="margin-bottom-1">Domain requests</h1>
<div class="grid-row grid-gap"> <div class="grid-row grid-gap">
{% if has_edit_request_portfolio_permission %} {% if has_edit_request_portfolio_permission %}
<div class="mobile:grid-col-12 tablet:grid-col-6"> <div class="mobile:grid-col-12 tablet:grid-col-6">
<p class="margin-y-0">Domain requests can only be modified by the person who created the request.</p> <p class="margin-y-0 maxw-mobile">Domain requests can only be modified by the person who created the request.</p>
</div> </div>
<div class="mobile:grid-col-12 tablet:grid-col-6"> <div class="mobile:grid-col-12 tablet:grid-col-6">

View file

@ -2162,7 +2162,7 @@ class TestRequestingEntity(WebTest):
self.assertContains(response, "Add suborganization information") self.assertContains(response, "Add suborganization information")
# We expect to see the portfolio name in two places: # We expect to see the portfolio name in two places:
# the header, and as one of the radio button options. # the header, and as one of the radio button options.
self.assertContains(response, self.portfolio.organization_name, count=2) self.assertContains(response, self.portfolio.organization_name, count=3)
# We expect the dropdown list to contain the suborganizations that currently exist on this portfolio # We expect the dropdown list to contain the suborganizations that currently exist on this portfolio
self.assertContains(response, self.suborganization.name, count=1) self.assertContains(response, self.suborganization.name, count=1)
@ -2298,9 +2298,13 @@ class TestRequestingEntity(WebTest):
form["portfolio_requesting_entity-is_requesting_new_suborganization"] = True form["portfolio_requesting_entity-is_requesting_new_suborganization"] = True
response = form.submit() response = form.submit()
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
self.assertContains(response, "Requested suborganization is required.", status_code=200) self.assertContains(response, "Enter the name of your suborganization.", status_code=200)
self.assertContains(response, "City is required.", status_code=200) self.assertContains(response, "Enter the city where your suborganization is located.", status_code=200)
self.assertContains(response, "State, territory, or military post is required.", status_code=200) self.assertContains(
response,
"Select the state, territory, or military post where your suborganization is located.",
status_code=200,
)
@override_flag("organization_feature", active=True) @override_flag("organization_feature", active=True)
@override_flag("organization_requests", active=True) @override_flag("organization_requests", active=True)

View file

@ -3205,11 +3205,6 @@ class TestDomainRequestWizard(TestWithUser, WebTest):
expected_url = reverse("domain-request:portfolio_requesting_entity", kwargs={"id": domain_request.id}) expected_url = reverse("domain-request:portfolio_requesting_entity", kwargs={"id": domain_request.id})
# This returns the entire url, thus "in" # This returns the entire url, thus "in"
self.assertIn(expected_url, detail_page.request.url) self.assertIn(expected_url, detail_page.request.url)
# We shouldn't show the "domains" and "domain requests" buttons
# on this page.
self.assertNotContains(detail_page, "Domains")
self.assertNotContains(detail_page, "<span>Domain requests")
else: else:
self.fail(f"Expected a redirect, but got a different response: {response}") self.fail(f"Expected a redirect, but got a different response: {response}")

View file

@ -317,15 +317,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
# Clear context so the prop getter won't create a request here. # Clear context so the prop getter won't create a request here.
# Creating a request will be handled in the post method for the # Creating a request will be handled in the post method for the
# intro page. # intro page.
return render( return render(request, "domain_request_intro.html")
request,
"domain_request_intro.html",
{
"hide_requests": True,
"hide_domains": True,
"hide_members": True,
},
)
else: else:
return self.goto(self.steps.first) return self.goto(self.steps.first)
@ -487,12 +479,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
"user": self.request.user, "user": self.request.user,
"requested_domain__name": requested_domain_name, "requested_domain__name": requested_domain_name,
} }
# Hides the requests and domains buttons in the navbar
context["hide_requests"] = self.is_portfolio
context["hide_domains"] = self.is_portfolio
context["domain_request_id"] = self.domain_request.id context["domain_request_id"] = self.domain_request.id
return context return context
def get_step_list(self) -> list: def get_step_list(self) -> list: