Skip to content

Commit

Permalink
Merge pull request #2735 from cisagov/rb/2687-copy-request-summary
Browse files Browse the repository at this point in the history
Issue #2687: Account for different superuser and analyst markup for copy request summary
  • Loading branch information
rachidatecs authored Sep 12, 2024
2 parents 91b69a3 + 39c881d commit 58a32df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/registrar/assets/js/get-gov-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,10 @@ function initializeWidgetOnList(list, parentId) {

//------ Requested Domains
const requestedDomainElement = document.getElementById('id_requested_domain');
const requestedDomain = requestedDomainElement.options[requestedDomainElement.selectedIndex].text;
// We have to account for different superuser and analyst markups
const requestedDomain = requestedDomainElement.options
? requestedDomainElement.options[requestedDomainElement.selectedIndex].text
: requestedDomainElement.text;

//------ Submitter
// Function to extract text by ID and handle missing elements
Expand All @@ -762,7 +765,10 @@ function initializeWidgetOnList(list, parentId) {
// Extract the submitter name, title, email, and phone number
const submitterDiv = document.querySelector('.form-row.field-submitter');
const submitterNameElement = document.getElementById('id_submitter');
const submitterName = submitterNameElement.options[submitterNameElement.selectedIndex].text;
// We have to account for different superuser and analyst markups
const submitterName = submitterNameElement
? submitterNameElement.options[submitterNameElement.selectedIndex].text
: submitterDiv.querySelector('a').text;
const submitterTitle = extractTextById('contact_info_title', submitterDiv);
const submitterEmail = extractTextById('contact_info_email', submitterDiv);
const submitterPhone = extractTextById('contact_info_phone', submitterDiv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
{% endif %}
{% elif field.field.name == "requested_domain" %}
{% with current_path=request.get_full_path %}
<a class="margin-top-05 padding-top-05" href="{% url 'admin:registrar_draftdomain_change' original.requested_domain.id %}?{{ 'return_path='|add:current_path }}">{{ original.requested_domain }}</a>
<a class="margin-top-05 padding-top-05" id="id_requested_domain" href="{% url 'admin:registrar_draftdomain_change' original.requested_domain.id %}?{{ 'return_path='|add:current_path }}">{{ original.requested_domain }}</a>
{% endwith%}
{% elif field.field.name == "current_websites" %}
{% comment %}
Expand Down

0 comments on commit 58a32df

Please sign in to comment.