This commit is contained in:
zandercymatics 2024-03-27 13:52:44 -06:00
parent 22412c1958
commit d9b4d58e55
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 137 additions and 103 deletions

View file

@ -389,6 +389,46 @@ table.dja-user-detail-table {
} }
ul.padding-left-0__detail-list {
padding-left: 0 !important;
}
ul.margin-left-0__detail-list {
margin-left: 0 !important;
}
ul.margin-top-neg-1__detail-list {
margin-top: -8px !important;
}
.dja-detail-list {
dl {
padding-left: 0px !important;
}
// Mimic the normal label size
dt {
font-size: 0.8125rem;
color: var(--body-quiet-color);
}
address {
font-size: 0.8125rem;
color: var(--body-quiet-color);
}
}
// Mimic the normal label size
@media (max-width: 1024px){
.dja-detail-list dt {
font-size: 0.875rem;
color: var(--body-quiet-color);
}
.dja-detail-list address {
font-size: 0.875rem;
color: var(--body-quiet-color);
}
}
.errors span.select2-selection { .errors span.select2-selection {
border: 1px solid var(--error-fg) !important; border: 1px solid var(--error-fg) !important;
} }

View file

@ -0,0 +1,47 @@
{% load i18n static %}
<ul class="{% if no_title_top_padding %}margin-top-neg-1__detail-list{% endif %} padding-top-0 padding-left-0__detail-list margin-left-0__detail-list" {% if field_name %} id="id_detail_list__{{field_name}}" {% endif %}>
{% if user.title or user.contact.title or user.email or user.contact.email or user.phone or user.contact.phone %}
{# Title #}
<li>
{% if user.title or user.contact.title %}
{% if user.contact.title %}
{{ user.contact.title }}
{% else %}
{{ user.title }}
{% endif %}
{% else %}
None
{% endif %}
</li>
{# Email #}
<li>
{% if user.email or user.contact.email %}
{% if user.contact.email %}
{{ user.contact.email }}
{% else %}
{{ user.email }}
{% endif %}
{% else %}
None
{% endif %}
</li>
{# Phone #}
<li>
{% if user.phone or user.contact.phone %}
{% if user.contact.phone %}
{{ user.contact.phone.as_national }}
{% else %}
{{ user.phone.as_national }}
{% endif %}
{% else %}
None
{% endif %}
</li>
{% else %}
<li>
No additional contact information found.
</li>
{% endif %}
</ul>

View file

@ -1,67 +0,0 @@
{% load i18n static %}
<table class="dja-user-detail-table" {% if field_name %} id="id_detail_table__{{field_name}}" {% endif %}>
{% if show_table_details %}
<thead>
<tr>
<th colspan="2">Contact details</th>
<tr>
</thead>
{% endif %}
{% if user.title or user.contact.title or user.email or user.contact.email or user.phone or user.contact.phone %}
<tbody>
<tr>
{% if show_table_details %}
<th class="{% if no_title_top_padding %}padding-top-0{% endif %}" scope="row">Title</th>
{% endif %}
{% if user.title or user.contact.title %}
{% if user.contact.title %}
<td class="{% if no_title_top_padding %}padding-top-0{% endif %} padding-left-0">{{ user.contact.title }}</td>
{% else %}
<td class="{% if no_title_top_padding %}padding-top-0{% endif %} padding-left-0">{{ user.title }}</td>
{% endif %}
{% else %}
<td class="{% if no_title_top_padding %}padding-top-0{% endif %} padding-left-0">None</td>
{% endif %}
</tr>
<tr>
{% if show_table_details %}
<th class="padding-top-0 padding-left-0" scope="row">Email</th>
{% endif %}
{% if user.email or user.contact.email %}
{% if user.contact.email %}
<td class="padding-top-0 padding-left-0">{{ user.contact.email }}</td>
{% else %}
<td class="padding-top-0 padding-left-0">{{ user.email }}</td>
{% endif %}
{% else %}
<td class="padding-top-0 padding-left-0">None</td>
{% endif %}
</tr>
<tr>
{% if show_table_details %}
<th class="padding-top-0 padding-left-0" scope="row">Phone</th>
{% endif %}
{% if user.phone or user.contact.phone %}
{% if user.contact.phone %}
<td class="padding-top-0 padding-left-0">{{ user.contact.phone }}</td>
{% else %}
<td class="padding-top-0 padding-left-0">{{ user.phone }}</td>
{% endif %}
{% else %}
<td class="padding-top-0 padding-left-0">None</td>
{% endif %}
</tr>
</tbody>
{% else %}
<tbody>
<tr>
<td class="padding-left-0">No additional contact information found.</td>
</tr>
</tbody>
{% endif %}
</table>

View file

@ -5,12 +5,33 @@
This is using a custom implementation fieldset.html (see admin/fieldset.html) This is using a custom implementation fieldset.html (see admin/fieldset.html)
{% endcomment %} {% endcomment %}
{% block field_readonly %} {% block field_readonly %}
{% with all_contacts=original.other_contacts.all %}
{% if field.field.name == "other_contacts" %} {% if field.field.name == "other_contacts" %}
{% if all_contacts.count > 2 %}
<div class="readonly"> <div class="readonly">
{% for contact in field.contents|split:", " %} {% for contact in field.contents|split:", " %}
<a href="#" class="other-contact__{{forloop.counter}}">{{ contact }}</a>{% if not forloop.last %}, {% endif %} <a href="#" class="other-contact__{{forloop.counter}}">{{ contact }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %} {% endfor %}
</div> </div>
{% else %}
<div class="flex-container dja-detail-list">
<dl class="usa-list usa-list--unstyled margin-0 margin-top-1">
{% for contact in all_contacts %}
<dt class="{% if forloop.counter == 1%}margin-top-0{% endif %}">
Organization contact {{forloop.counter}}
</dt>
<dd>
<address>
{% if contact.get_formatted_name %}<a href="{% url 'admin:registrar_contact_change' contact.id %}">{{ contact.get_formatted_name }}</a><br />{% else %}None<br />{% endif %}
{% if contact.title %}{{ contact.title }}<br />{% else %}None<br />{% endif %}
{% if contact.email %}{{ contact.email }}<br />{% else %}None<br />{% endif %}
{% if contact.phone %}{{ contact.phone.as_national }}{% else %}None{% endif %}
</address>
</dd>
{% endfor %}
</dl>
</div>
{% endif %}
{% elif field.field.name == "current_websites" %} {% elif field.field.name == "current_websites" %}
{% comment %} {% comment %}
The "website" model is essentially just a text field. The "website" model is essentially just a text field.
@ -34,35 +55,28 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
{% else %} {% else %}
<div class="readonly">{{ field.contents }}</div> <div class="readonly">{{ field.contents }}</div>
{% endif %} {% endif %}
{% endwith %}
{% endblock field_readonly %} {% endblock field_readonly %}
{% block after_help_text %} {% block after_help_text %}
{% if field.field.name == "creator" %} {% if field.field.name == "creator" %}
<div class="flex-container"> <div class="flex-container">
<label aria-label="Creator contact details"></label> <label aria-label="Creator contact details"></label>
{% include "django/admin/includes/contact_detail_table.html" with user=original.creator field_name="creator" no_title_top_padding=field.is_readonly %} {% include "django/admin/includes/contact_detail_list.html" with user=original.creator field_name="creator" no_title_top_padding=field.is_readonly %}
</div> </div>
{% elif field.field.name == "submitter" %} {% elif field.field.name == "submitter" %}
<div class="flex-container"> <div class="flex-container">
<label aria-label="Submitter contact details"></label> <label aria-label="Submitter contact details"></label>
{% include "django/admin/includes/contact_detail_table.html" with user=original.submitter field_name="submitter" no_title_top_padding=field.is_readonly %} {% include "django/admin/includes/contact_detail_list.html" with user=original.submitter field_name="submitter" no_title_top_padding=field.is_readonly %}
</div> </div>
{% elif field.field.name == "authorizing_official" %} {% elif field.field.name == "authorizing_official" %}
<div class="flex-container"> <div class="flex-container">
<label aria-label="Authorizing official contact details"></label> <label aria-label="Authorizing official contact details"></label>
{% include "django/admin/includes/contact_detail_table.html" with user=original.authorizing_official field_name="authorizing_official" no_title_top_padding=field.is_readonly %} {% include "django/admin/includes/contact_detail_list.html" with user=original.authorizing_official field_name="authorizing_official" no_title_top_padding=field.is_readonly %}
</div> </div>
{% elif field.field.name == "other_contacts" and original.other_contacts.all %} {% elif field.field.name == "other_contacts" and original.other_contacts.all %}
{% with all_contacts=original.other_contacts.all %} {% with all_contacts=original.other_contacts.all %}
{% if all_contacts.count == 1 %} {% if all_contacts.count > 2 %}
{% for contact in all_contacts %}
<div class="flex-container">
<label aria-label="Other contact details"></label>
<div class="display-none other-contact-id" data-contact-url="{% url 'admin:registrar_contact_change' contact.id %}"></div>
{% include "django/admin/includes/contact_detail_table.html" with user=contact field_name="other_contact" no_title_top_padding=field.is_readonly %}
</div>
{% endfor %}
{% else %}
<details class="margin-top-1 dja-detail-table" aria-role="button"> <details class="margin-top-1 dja-detail-table" aria-role="button">
<summary class="padding-1 padding-left-0 dja-details-summary">Details</summary> <summary class="padding-1 padding-left-0 dja-details-summary">Details</summary>
<div class="grid-container margin-left-0 padding-left-0 padding-right-0 dja-details-contents"> <div class="grid-container margin-left-0 padding-left-0 padding-right-0 dja-details-contents">