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
|
# Read only that we'll leverage for CISA Analysts
|
||||||
analyst_readonly_fields = [
|
analyst_readonly_fields = [
|
||||||
"creator",
|
"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
|
# Read only that we'll leverage for CISA Analysts
|
||||||
analyst_readonly_fields = [
|
analyst_readonly_fields = [
|
||||||
"creator",
|
"creator",
|
||||||
|
|
|
@ -1,47 +1,67 @@
|
||||||
{% load i18n static %}
|
{% 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>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">Contact details</th>
|
<th colspan="2">Contact details</th>
|
||||||
<tr>
|
<tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if user.title or user.contact.title or user.email or user.contact.email or user.phone or user.contact.phone %}
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<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.title or user.contact.title %}
|
||||||
{% if 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 %}
|
{% else %}
|
||||||
<td>{{ user.title }}</td>
|
<td class="{% if no_title_top_padding %}padding-top-0{% endif %} padding-left-0">{{ user.title }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<td>Nothing found</td>
|
<td class="{% if no_title_top_padding %}padding-top-0{% endif %} padding-left-0">None</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
<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.email or user.contact.email %}
|
||||||
{% if 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 %}
|
{% else %}
|
||||||
<td class="padding-top-0">{{ user.email }}</td>
|
<td class="padding-top-0 padding-left-0">{{ user.email }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<td class="padding-top-0">Nothing found</td>
|
<td class="padding-top-0 padding-left-0">None</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
<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.phone or user.contact.phone %}
|
||||||
{% if 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 %}
|
{% else %}
|
||||||
<td class="padding-top-0">{{ user.phone }}</td>
|
<td class="padding-top-0 padding-left-0">{{ user.phone }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<td class="padding-top-0">Nothing found</td>
|
<td class="padding-top-0 padding-left-0">None</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
{% else %}
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="padding-left-0">No additional contact information found.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
{% endif %}
|
||||||
</table>
|
</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.
|
This ONLY applies to analysts. For superusers, its business as usual.
|
||||||
{% endcomment %}
|
{% 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 %}
|
<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 %}
|
{% endfor %}
|
||||||
|
{% endwith %}
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="readonly">{{ field.contents }}</div>
|
<div class="readonly">{{ field.contents }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -32,44 +40,55 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
||||||
{% 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" %}
|
{% include "django/admin/includes/contact_detail_table.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" %}
|
{% include "django/admin/includes/contact_detail_table.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" %}
|
{% 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>
|
</div>
|
||||||
{% elif field.field.name == "other_contacts" and original.other_contacts.all %}
|
{% elif field.field.name == "other_contacts" and original.other_contacts.all %}
|
||||||
<details class="margin-top-1 dja-detail-table" aria-role="button">
|
{% with all_contacts=original.other_contacts.all %}
|
||||||
<summary class="padding-1 padding-left-0 dja-details-summary">Details</summary>
|
{% if all_contacts.count == 1 %}
|
||||||
<div class="grid-container margin-left-0 padding-left-0 padding-right-0 dja-details-contents">
|
{% for contact in all_contacts %}
|
||||||
<table>
|
<div class="flex-container">
|
||||||
<thead>
|
<label aria-label="Other contact details"></label>
|
||||||
<tr>
|
{% include "django/admin/includes/contact_detail_table.html" with user=contact field_name="other_contact" no_title_top_padding=field.is_readonly %}
|
||||||
<th colspan="4">Contact information</th>
|
</div>
|
||||||
<tr>
|
{% endfor %}
|
||||||
</thead>
|
{% else %}
|
||||||
<tbody>
|
<details class="margin-top-1 dja-detail-table" aria-role="button">
|
||||||
{% for contact in original.other_contacts.all %}
|
<summary class="padding-1 padding-left-0 dja-details-summary">Details</summary>
|
||||||
{% comment %}
|
<div class="grid-container margin-left-0 padding-left-0 padding-right-0 dja-details-contents">
|
||||||
Since we can't get the id from field, we can embed this information here.
|
<table>
|
||||||
Then we can link these two fields using javascript.
|
<thead>
|
||||||
{% endcomment %}
|
<tr>
|
||||||
<tr data-contact-id="{{ contact.id }}" data-contact-url="{% url 'admin:registrar_contact_change' contact.id %}">
|
<th colspan="4">Contact information</th>
|
||||||
<th class="padding-left-1" scope="row">{{contact.first_name}} {{contact.last_name}}</th>
|
<tr>
|
||||||
<td class="padding-left-1">{{ contact.title }}</td>
|
</thead>
|
||||||
<td class="padding-left-1">{{ contact.email }}</td>
|
<tbody>
|
||||||
<td class="padding-left-1">{{ contact.phone }}</td>
|
{% for contact in all_contacts %}
|
||||||
</tr>
|
{% comment %}
|
||||||
{% endfor %}
|
Since we can't get the id from field, we can embed this information here.
|
||||||
</tbody>
|
Then we can link these two fields using javascript.
|
||||||
</table>
|
{% endcomment %}
|
||||||
</div>
|
<tr data-contact-id="{{ contact.id }}" data-contact-url="{% url 'admin:registrar_contact_change' contact.id %}">
|
||||||
</details>
|
<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 %}
|
{% endif %}
|
||||||
{% endblock after_help_text %}
|
{% endblock after_help_text %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue