mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-19 19:09:22 +02:00
PR suggestions
This commit is contained in:
parent
55fd53fb56
commit
a70214e467
3 changed files with 88 additions and 43 deletions
|
@ -910,6 +910,9 @@ class DomainInformationAdmin(ListHeaderAdmin):
|
|||
),
|
||||
]
|
||||
|
||||
# Readonly fields for analysts and superusers
|
||||
readonly_fields = ("other_contacts",)
|
||||
|
||||
# Read only that we'll leverage for CISA Analysts
|
||||
analyst_readonly_fields = [
|
||||
"creator",
|
||||
|
@ -1120,6 +1123,9 @@ class DomainRequestAdmin(ListHeaderAdmin):
|
|||
),
|
||||
]
|
||||
|
||||
# Readonly fields for analysts and superusers
|
||||
readonly_fields = ("other_contacts", "current_websites")
|
||||
|
||||
# Read only that we'll leverage for CISA Analysts
|
||||
analyst_readonly_fields = [
|
||||
"creator",
|
||||
|
|
|
@ -1,47 +1,67 @@
|
|||
{% load i18n static %}
|
||||
|
||||
<table class="dja-user-detail-table margin-top-1" {% if field_name %} id="id_detail_table__{{field_name}}" {% endif %}>
|
||||
<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>
|
||||
<th scope="row">Title</th>
|
||||
{% 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>{{ user.contact.title }}</td>
|
||||
<td class="{% if no_title_top_padding %}padding-top-0{% endif %} padding-left-0">{{ user.contact.title }}</td>
|
||||
{% else %}
|
||||
<td>{{ user.title }}</td>
|
||||
<td class="{% if no_title_top_padding %}padding-top-0{% endif %} padding-left-0">{{ user.title }}</td>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<td>Nothing found</td>
|
||||
<td class="{% if no_title_top_padding %}padding-top-0{% endif %} padding-left-0">None</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="padding-top-0" scope="row">Email</th>
|
||||
{% 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">{{ user.contact.email }}</td>
|
||||
<td class="padding-top-0 padding-left-0">{{ user.contact.email }}</td>
|
||||
{% else %}
|
||||
<td class="padding-top-0">{{ user.email }}</td>
|
||||
<td class="padding-top-0 padding-left-0">{{ user.email }}</td>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<td class="padding-top-0">Nothing found</td>
|
||||
<td class="padding-top-0 padding-left-0">None</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="padding-top-0" scope="row">Phone</th>
|
||||
{% 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">{{ user.contact.phone }}</td>
|
||||
<td class="padding-top-0 padding-left-0">{{ user.contact.phone }}</td>
|
||||
{% else %}
|
||||
<td class="padding-top-0">{{ user.phone }}</td>
|
||||
<td class="padding-top-0 padding-left-0">{{ user.phone }}</td>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<td class="padding-top-0">Nothing found</td>
|
||||
<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>
|
||||
|
|
|
@ -20,9 +20,17 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
|||
|
||||
This ONLY applies to analysts. For superusers, its business as usual.
|
||||
{% endcomment %}
|
||||
{% for website in field.contents|split:", " %}
|
||||
<div class="readonly">
|
||||
{% with total_websites=field.contents|split:", " %}
|
||||
{% for website in total_websites %}
|
||||
<a href="{{ website }}" class="padding-top-1 current-website__{{forloop.counter}}">{{ website }}</a>{% if not forloop.last %}, {% endif %}
|
||||
{# Acts as a <br> #}
|
||||
{% if total_websites|length < 5 %}
|
||||
<div class="display-block margin-top-1"></div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="readonly">{{ field.contents }}</div>
|
||||
{% endif %}
|
||||
|
@ -32,44 +40,55 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
|||
{% if field.field.name == "creator" %}
|
||||
<div class="flex-container">
|
||||
<label aria-label="Creator contact details"></label>
|
||||
{% include "django/admin/includes/contact_detail_table.html" with user=original.creator field_name="creator" %}
|
||||
{% include "django/admin/includes/contact_detail_table.html" with user=original.creator field_name="creator" no_title_top_padding=field.is_readonly %}
|
||||
</div>
|
||||
{% elif field.field.name == "submitter" %}
|
||||
<div class="flex-container">
|
||||
<label aria-label="Submitter contact details"></label>
|
||||
{% include "django/admin/includes/contact_detail_table.html" with user=original.submitter field_name="submitter" %}
|
||||
{% include "django/admin/includes/contact_detail_table.html" with user=original.submitter field_name="submitter" no_title_top_padding=field.is_readonly %}
|
||||
</div>
|
||||
{% elif field.field.name == "authorizing_official" %}
|
||||
<div class="flex-container">
|
||||
<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" %}
|
||||
{% include "django/admin/includes/contact_detail_table.html" with user=original.authorizing_official field_name="authorizing_official" no_title_top_padding=field.is_readonly %}
|
||||
</div>
|
||||
{% elif field.field.name == "other_contacts" and original.other_contacts.all %}
|
||||
<details class="margin-top-1 dja-detail-table" aria-role="button">
|
||||
<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">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">Contact information</th>
|
||||
<tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for contact in original.other_contacts.all %}
|
||||
{% comment %}
|
||||
Since we can't get the id from field, we can embed this information here.
|
||||
Then we can link these two fields using javascript.
|
||||
{% endcomment %}
|
||||
<tr data-contact-id="{{ contact.id }}" data-contact-url="{% url 'admin:registrar_contact_change' contact.id %}">
|
||||
<th class="padding-left-1" scope="row">{{contact.first_name}} {{contact.last_name}}</th>
|
||||
<td class="padding-left-1">{{ contact.title }}</td>
|
||||
<td class="padding-left-1">{{ contact.email }}</td>
|
||||
<td class="padding-left-1">{{ contact.phone }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</details>
|
||||
{% with all_contacts=original.other_contacts.all %}
|
||||
{% if all_contacts.count == 1 %}
|
||||
{% for contact in all_contacts %}
|
||||
<div class="flex-container">
|
||||
<label aria-label="Other contact details"></label>
|
||||
{% 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">
|
||||
<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">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">Contact information</th>
|
||||
<tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for contact in all_contacts %}
|
||||
{% comment %}
|
||||
Since we can't get the id from field, we can embed this information here.
|
||||
Then we can link these two fields using javascript.
|
||||
{% endcomment %}
|
||||
<tr data-contact-id="{{ contact.id }}" data-contact-url="{% url 'admin:registrar_contact_change' contact.id %}">
|
||||
<th class="padding-left-1" scope="row">{{contact.first_name}} {{contact.last_name}}</th>
|
||||
<td class="padding-left-1">{{ contact.title }}</td>
|
||||
<td class="padding-left-1">{{ contact.email }}</td>
|
||||
<td class="padding-left-1">{{ contact.phone }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</details>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endblock after_help_text %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue