From a8c10816b8e6913b57ba9369d7adae4fcbb0eb10 Mon Sep 17 00:00:00 2001
From: zandercymatics <141044360+zandercymatics@users.noreply.github.com>
Date: Tue, 19 Mar 2024 15:49:32 -0600
Subject: [PATCH] Add links to urls
---
src/registrar/assets/js/get-gov-admin.js | 44 +++++++++++++++++++
src/registrar/assets/sass/_theme/_admin.scss | 32 ++++++++++++++
.../includes/domain_request_detail_table.html | 42 +++++++-----------
.../includes/domain_request_fieldset.html | 24 +++++++---
src/registrar/templatetags/url_helpers.py | 7 +++
5 files changed, 117 insertions(+), 32 deletions(-)
diff --git a/src/registrar/assets/js/get-gov-admin.js b/src/registrar/assets/js/get-gov-admin.js
index 4ed00c33f..28149999c 100644
--- a/src/registrar/assets/js/get-gov-admin.js
+++ b/src/registrar/assets/js/get-gov-admin.js
@@ -170,6 +170,50 @@ function checkToListThenInitWidget(toListId, attempts) {
}
}
+(function() {
+ function addUrlsToOtherContacts() {
+ document.addEventListener('DOMContentLoaded', function() {
+ // Select all table rows that have a data-contact-id attribute
+ let contactRows = document.querySelectorAll("tr[data-contact-url]");
+
+ if (contactRows){
+ // Add a click event listener to each row
+ let index = 1;
+ contactRows.forEach(function(row) {
+ let otherContactUrl = row.getAttribute("data-contact-url");
+ if (otherContactUrl){
+ let otherContact = document.querySelector(`.other-contact__${index}`);
+ if (otherContact) {
+ otherContact.href = otherContactUrl;
+ }
+ }
+ index++;
+ });
+ }
+ });
+ }
+
+ addUrlsToOtherContacts()
+})();
+
+document.addEventListener('DOMContentLoaded', function() {
+ // Select all table rows that have a data-contact-id attribute
+ let contactRows = document.querySelectorAll("tr[data-contact-url]");
+
+ // Add a click event listener to each row
+ index = 1
+ contactRows.forEach(function(row) {
+ let otherContactUrl = row.getAttribute("data-contact-url");
+ if (otherContactUrl){
+ let otherContact = document.querySelector(`.other-contact__${index}`)
+ if (otherContact) {
+ otherContact.href = otherContactUrl
+ }
+ }
+ index++
+ });
+});
+
// Initialize the widget:
// add related buttons to the widget for edit, delete and view
// add event listeners on the from list, the to list, and selector buttons which either enable or disable the related buttons
diff --git a/src/registrar/assets/sass/_theme/_admin.scss b/src/registrar/assets/sass/_theme/_admin.scss
index 596de17ac..98e5009db 100644
--- a/src/registrar/assets/sass/_theme/_admin.scss
+++ b/src/registrar/assets/sass/_theme/_admin.scss
@@ -330,3 +330,35 @@ details.dja-detail-table {
}
}
}
+
+table.dja-user-detail-table {
+ margin-left: 160px;
+ tr {
+ background-color: var(--body-bg);
+ }
+}
+
+.admin-icon-group {
+ position: relative;
+ display: flex;
+ align-items: center;
+
+ .usa-button__icon {
+ position: absolute;
+ right: 0;
+ height: 100%;
+ }
+
+ input {
+ // Allow for padding around the copy button
+ padding-right: 35px;
+ // Match the height of other inputs
+ min-height: 2.25rem;
+ }
+
+ .no-outline-on-click:focus {
+ outline: none !important;
+ }
+}
+
+
diff --git a/src/registrar/templates/django/admin/includes/domain_request_detail_table.html b/src/registrar/templates/django/admin/includes/domain_request_detail_table.html
index f34ffa491..fba588b61 100644
--- a/src/registrar/templates/django/admin/includes/domain_request_detail_table.html
+++ b/src/registrar/templates/django/admin/includes/domain_request_detail_table.html
@@ -1,28 +1,18 @@
{% load i18n static %}
-
-Details
-
-
-
- {% else %}
-
-
- Title
- {{ user.title }}
-
-
- Email
- {{ user.email }}
-
-
-
- Phone
- {{ user.phone }}
-
Title | +{{ user.title }} | +
---|---|
{{ user.email }} | +|
Phone | +{{ user.phone }} | +
{{contact.first_name}} {{contact.last_name}} | {{ contact.title }} | {{ contact.email }} | diff --git a/src/registrar/templatetags/url_helpers.py b/src/registrar/templatetags/url_helpers.py index 931eedc92..9413892aa 100644 --- a/src/registrar/templatetags/url_helpers.py +++ b/src/registrar/templatetags/url_helpers.py @@ -26,6 +26,13 @@ def endswith(text, ends): return False +@register.filter("split") +def split_string(value, key): + """ + Splits a given string + """ + return value.split(key) + @register.simple_tag def public_site_url(url_path): """Make a full URL for this path at our public site.
---|