mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-31 23:16:36 +02:00
Fix domain request button
This commit is contained in:
parent
d870127eb3
commit
40fd46a2bb
3 changed files with 32 additions and 14 deletions
|
@ -761,3 +761,10 @@ div.dja__model-description{
|
|||
.usa-summary-box h3 {
|
||||
color: #{$dhs-blue-60};
|
||||
}
|
||||
|
||||
.analytics-button-group {
|
||||
flex-wrap: wrap;
|
||||
a {
|
||||
min-width: 160px !important;
|
||||
}
|
||||
}
|
|
@ -27,36 +27,35 @@
|
|||
<div class="module height-full">
|
||||
<h2>Current domains</h2>
|
||||
<div class="padding-top-2 padding-x-2">
|
||||
<ul class="usa-button-group">
|
||||
<ul class="usa-button-group analytics-button-group">
|
||||
<li class="usa-button-group__item">
|
||||
<a href="{% url 'export_data_type' %}" class="button" role="button">
|
||||
<a href="{% url 'export_data_type' %}" class="button text-no-wrap" role="button">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="{%static 'img/sprite.svg'%}#file_download"></use>
|
||||
</svg><span class="margin-left-05">All domain metadata</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="usa-button-group__item">
|
||||
<a href="{% url 'export_data_full' %}" class="button" role="button">
|
||||
<a href="{% url 'export_data_full' %}" class="button text-no-wrap" role="button">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="{%static 'img/sprite.svg'%}#file_download"></use>
|
||||
</svg><span class="margin-left-05">Current full</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="usa-button-group__item">
|
||||
<a href="{% url 'export_data_federal' %}" class="button" role="button">
|
||||
<a href="{% url 'export_data_federal' %}" class="button text-no-wrap" role="button">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="{%static 'img/sprite.svg'%}#file_download"></use>
|
||||
</svg><span class="margin-left-05">Current federal</span>
|
||||
</a>
|
||||
</li>
|
||||
{# TODO: move this and rename it #}
|
||||
<li class="usa-button-group__item">
|
||||
<a href="{% url 'export_data_domain_requests_full' %}" class="button" role="button">
|
||||
<a href="{% url 'export_data_domain_requests_full' %}" class="button text-no-wrap" role="button">
|
||||
<svg class="usa-icon" aria-hidden="true" focusable="false" role="img" width="24" height="24">
|
||||
<use xlink:href="{%static 'img/sprite.svg'%}#file_download"></use>
|
||||
</svg><span class="margin-left-05">Current domain request full</span>
|
||||
</svg><span class="margin-left-05">All domain requests</span>
|
||||
</a>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -15,6 +15,7 @@ from django.utils import timezone
|
|||
from django.core.paginator import Paginator
|
||||
from django.db.models.functions import Concat, Coalesce
|
||||
from django.contrib.postgres.aggregates import StringAgg
|
||||
from registrar.templatetags.custom_filters import get_region
|
||||
from registrar.utility.enums import DefaultEmail
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -750,7 +751,7 @@ class DomainRequestExport:
|
|||
# create a dictionary of fields which can be included in output
|
||||
FIELDS = {
|
||||
"Domain request": request.get("requested_domain_name"),
|
||||
"Submitted at": request.get("submission_date"), # TODO - different format?
|
||||
"Submitted at": request.get("submission_date"),
|
||||
"Status": request.get("status_display"),
|
||||
"Domain type": request.get("domain_type"),
|
||||
"Federal type": request.get("human_readable_federal_type"),
|
||||
|
@ -759,7 +760,7 @@ class DomainRequestExport:
|
|||
"Election office": request.get("human_readable_election_board"),
|
||||
"City": request.get("city"),
|
||||
"State/territory": request.get("state_territory"),
|
||||
"Region": None, # TODO - what is this field?
|
||||
"Region": request.get("region"),
|
||||
# Creator
|
||||
"Creator first name": request.get("creator__first_name", ""),
|
||||
"Creator last name": request.get("creator__last_name", ""),
|
||||
|
@ -963,6 +964,8 @@ class DomainRequestExport:
|
|||
"federal_type",
|
||||
)
|
||||
|
||||
# We can't natively call python functions from the ORM.
|
||||
# Thus in any place where we do that, we have to handle it here.
|
||||
for request in requests_dict:
|
||||
# Handle the domain_type field. Defaults to the wrong format.
|
||||
org_type = request.get("generic_org_type")
|
||||
|
@ -980,6 +983,11 @@ class DomainRequestExport:
|
|||
if status:
|
||||
request["status_display"] = DomainRequest.DomainRequestStatus.get_status_label(status)
|
||||
|
||||
# Handle the region field.
|
||||
state_territory = request.get("state_territory")
|
||||
if state_territory:
|
||||
request["region"] = get_region(state_territory)
|
||||
|
||||
return requests_dict
|
||||
|
||||
# ============================================================= #
|
||||
|
@ -1018,17 +1026,21 @@ class DomainRequestExport:
|
|||
"""
|
||||
|
||||
# TODO this should be replaced with cisa_representative_first_name and cisa_representative_last_name
|
||||
# When that PR gets merged
|
||||
additional_details_query = Case(
|
||||
# Check if either cisa_representative_email or anything_else is not null
|
||||
# TODO - touch up on this
|
||||
When(
|
||||
cisa_representative_email__isnull=False,
|
||||
anything_else__isnull=False,
|
||||
then=Concat(F("cisa_representative_email"), Value(delimiter), F("anything_else")),
|
||||
),
|
||||
When(
|
||||
cisa_representative_email__isnull=True,
|
||||
anything_else__isnull=False,
|
||||
then=Concat(F("cisa_representative_email"), Value(delimiter), F("anything_else")),
|
||||
then=F("anything_else"),
|
||||
),
|
||||
When(
|
||||
cisa_representative_email__isnull=False,
|
||||
anything_else__isnull=True,
|
||||
then=F("cisa_representative_email"),
|
||||
),
|
||||
default=Value(default_message),
|
||||
output_field=CharField(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue