diff --git a/src/registrar/assets/js/get-gov-admin.js b/src/registrar/assets/js/get-gov-admin.js index 19f6b7dbd..2ac16d919 100644 --- a/src/registrar/assets/js/get-gov-admin.js +++ b/src/registrar/assets/js/get-gov-admin.js @@ -140,6 +140,12 @@ function openInNewTab(el, removeAttribute = false){ /** An IIFE for pages in DjangoAdmin that use a clipboard button */ (function (){ + + function copyInnerTextToClipboard(elem) { + let text = elem.innerText + navigator.clipboard.writeText(text) + } + function copyToClipboardAndChangeIcon(button) { // Assuming the input is the previous sibling of the button let input = button.previousElementSibling; @@ -179,7 +185,6 @@ function openInNewTab(el, removeAttribute = false){ // Add a class that adds the outline style on click button.addEventListener("mousedown", function() { - console.log(`applying mousedown on ${this} vs ${button}`); this.classList.add("no-outline-on-click"); }); @@ -192,7 +197,19 @@ function openInNewTab(el, removeAttribute = false){ }); } + function handleClipboardLinks() { + let emailButtons = document.querySelectorAll(".usa-button__clipboard-link"); + if (emailButtons){ + emailButtons.forEach((button) => { + button.addEventListener("click", ()=>{ + copyInnerTextToClipboard(button); + }) + }); + } + } + handleClipboardButtons(); + handleClipboardLinks(); })(); diff --git a/src/registrar/assets/sass/_theme/_admin.scss b/src/registrar/assets/sass/_theme/_admin.scss index c777ef291..d1e000033 100644 --- a/src/registrar/assets/sass/_theme/_admin.scss +++ b/src/registrar/assets/sass/_theme/_admin.scss @@ -404,6 +404,13 @@ address.margin-top-neg-1__detail-list { address.dja-address-contact-list { font-size: 0.8125rem; color: var(--body-quiet-color); + button.usa-button__clipboard-link { + font-size: 0.8125rem !important; + } +} + +td button.usa-button__clipboard-link { + font-size: 0.8125rem !important; } // Mimic the normal label size @@ -416,6 +423,14 @@ address.dja-address-contact-list { font-size: 0.875rem; color: var(--body-quiet-color); } + + address button.usa-button__clipboard-link { + font-size: 0.875rem !important; + } + + td button.usa-button__clipboard-link { + font-size: 0.875rem !important; + } } .errors span.select2-selection { @@ -442,8 +457,6 @@ address.dja-address-contact-list { } -td.font-size-sm { - button.usa-button__icon { - font-size: 16px; - } +.no-outline-on-click:focus { + outline: none !important; } \ No newline at end of file diff --git a/src/registrar/templates/django/admin/includes/contact_detail_list.html b/src/registrar/templates/django/admin/includes/contact_detail_list.html index 6afe4c8d6..cded7526b 100644 --- a/src/registrar/templates/django/admin/includes/contact_detail_list.html +++ b/src/registrar/templates/django/admin/includes/contact_detail_list.html @@ -25,9 +25,18 @@ {# Email #} {% if user.email or user.contact.email %} {% if user.contact.email %} + {% else %} + {% endif %}
{% else %} diff --git a/src/registrar/templates/django/admin/includes/contact_detail_table.html b/src/registrar/templates/django/admin/includes/contact_detail_table.html deleted file mode 100644 index b1afd6a68..000000000 --- a/src/registrar/templates/django/admin/includes/contact_detail_table.html +++ /dev/null @@ -1,65 +0,0 @@ -{% load i18n static %} - - - - - - {% if user.title or user.contact.title %} - {% if user.contact.title %} - - {% else %} - - {% endif %} - {% else %} - - {% endif %} - {# Placeholder col for actions (like copy) or additional padding #} - - - - - {% if user.email or user.contact.email %} - {% if user.contact.email %} - - {% else %} - - {% endif %} - - - - {% else %} - - - {% endif %} - - - - {% if user.phone or user.contact.phone %} - {% if user.contact.phone %} - - {% else %} - - {% endif %} - {% else %} - - {% endif %} - - - -
Title{{ user.contact.title }}{{ user.title }}Nothing found
Email{{ user.contact.email }}{{ user.email }} - {% if user.contact.email %} - - {% else %} - - {% endif %} - - Nothing found
Phone{{ user.contact.phone }}{{ user.phone }}Nothing 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 47145faf2..53bdbe821 100644 --- a/src/registrar/templates/django/admin/includes/detail_table_fieldset.html +++ b/src/registrar/templates/django/admin/includes/detail_table_fieldset.html @@ -92,7 +92,17 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html) {{ contact.get_formatted_name }} {{ contact.title }} - {{ contact.email }} + + + {{ contact.phone }} {% endfor %}