diff --git a/src/registrar/admin.py b/src/registrar/admin.py index febd8123c..e4a94e20d 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -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", diff --git a/src/registrar/templates/django/admin/includes/contact_detail_table.html b/src/registrar/templates/django/admin/includes/contact_detail_table.html index 68dbedb24..decce0f43 100644 --- a/src/registrar/templates/django/admin/includes/contact_detail_table.html +++ b/src/registrar/templates/django/admin/includes/contact_detail_table.html @@ -1,47 +1,67 @@ {% load i18n static %} - +
+ {% if show_table_details %} + {% endif %} + + {% if user.title or user.contact.title or user.email or user.contact.email or user.phone or user.contact.phone %} - + {% if show_table_details %} + + {% endif %} + {% if user.title or user.contact.title %} {% if user.contact.title %} - + {% else %} - + {% endif %} {% else %} - + {% endif %} - + {% if show_table_details %} + + {% endif %} + {% if user.email or user.contact.email %} {% if user.contact.email %} - + {% else %} - + {% endif %} {% else %} - + {% endif %} - + {% if show_table_details %} + + {% endif %} + {% if user.phone or user.contact.phone %} {% if user.contact.phone %} - + {% else %} - + {% endif %} {% else %} - + {% endif %} + {% else %} + + + + + + {% endif %}
Contact details
TitleTitle{{ user.contact.title }}{{ user.contact.title }}{{ user.title }}{{ user.title }}Nothing foundNone
EmailEmail{{ user.contact.email }}{{ user.contact.email }}{{ user.email }}{{ user.email }}Nothing foundNone
PhonePhone{{ user.contact.phone }}{{ user.contact.phone }}{{ user.phone }}{{ user.phone }}Nothing foundNone
No additional contact information found.
diff --git a/src/registrar/templates/django/admin/includes/detail_table_fieldset.html b/src/registrar/templates/django/admin/includes/detail_table_fieldset.html index 25b2826db..4ca577688 100644 --- a/src/registrar/templates/django/admin/includes/detail_table_fieldset.html +++ b/src/registrar/templates/django/admin/includes/detail_table_fieldset.html @@ -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:", " %} +
+ {% with total_websites=field.contents|split:", " %} + {% for website in total_websites %} {{ website }}{% if not forloop.last %}, {% endif %} + {# Acts as a
#} + {% if total_websites|length < 5 %} +
+ {% endif %} {% endfor %} + {% endwith %} +
{% else %}
{{ field.contents }}
{% endif %} @@ -32,44 +40,55 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html) {% if field.field.name == "creator" %}
- {% 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 %}
{% elif field.field.name == "submitter" %}
- {% 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 %}
{% elif field.field.name == "authorizing_official" %}
- {% 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 %}
{% elif field.field.name == "other_contacts" and original.other_contacts.all %} -
- Details -
- - - - - - - - {% 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 %} - - - - - - - {% endfor %} - -
Contact information
{{contact.first_name}} {{contact.last_name}}{{ contact.title }}{{ contact.email }}{{ contact.phone }}
-
-
+ {% with all_contacts=original.other_contacts.all %} + {% if all_contacts.count == 1 %} + {% for contact in all_contacts %} +
+ + {% include "django/admin/includes/contact_detail_table.html" with user=contact field_name="other_contact" no_title_top_padding=field.is_readonly %} +
+ {% endfor %} + {% else %} +
+ Details +
+ + + + + + + + {% 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 %} + + + + + + + {% endfor %} + +
Contact information
{{contact.first_name}} {{contact.last_name}}{{ contact.title }}{{ contact.email }}{{ contact.phone }}
+
+
+ {% endif %} + {% endwith %} {% endif %} {% endblock after_help_text %}