This commit is contained in:
David Kennedy 2024-05-22 14:58:42 -04:00
commit f5b6289e18
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 12 additions and 6 deletions

View file

@ -925,9 +925,9 @@ document.addEventListener('DOMContentLoaded', function() {
initializeTooltips(); initializeTooltips();
updatePagination(data.page, data.num_pages, data.has_previous, data.has_next); updatePagination(data.page, data.num_pages, data.has_previous, data.has_next);
currentPage = page; currentPage = page;
currentSortBy = sortBy; currentSortBy = sortBy;
currentOrder = order; currentOrder = order;
}) })
.catch(error => console.error('Error fetching domains:', error)); .catch(error => console.error('Error fetching domains:', error));
} }
@ -988,7 +988,10 @@ document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.dotgov-table th[data-sortable]').forEach(header => { document.querySelectorAll('.dotgov-table th[data-sortable]').forEach(header => {
header.addEventListener('click', function() { header.addEventListener('click', function() {
const sortBy = this.getAttribute('data-sortable'); const sortBy = this.getAttribute('data-sortable');
const order = currentOrder === 'asc' ? 'desc' : 'asc'; let order = 'asc';
if (sortBy === currentSortBy) {
order = currentOrder === 'asc' ? 'desc' : 'asc';
}
loadPage(1, sortBy, order); loadPage(1, sortBy, order);
}); });
}); });
@ -1132,7 +1135,10 @@ document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.dotgov-table__domain-requests th[data-sortable]').forEach(header => { document.querySelectorAll('.dotgov-table__domain-requests th[data-sortable]').forEach(header => {
header.addEventListener('click', function() { header.addEventListener('click', function() {
const sortBy = this.getAttribute('data-sortable'); const sortBy = this.getAttribute('data-sortable');
const order = currentOrder === 'asc' ? 'desc' : 'asc'; let order = 'asc';
if (sortBy === currentSortBy) {
order = currentOrder === 'asc' ? 'desc' : 'asc';
}
loadDomainRequestsPage(1, sortBy, order); loadDomainRequestsPage(1, sortBy, order);
}); });
}); });

View file

@ -76,7 +76,7 @@
<caption class="sr-only">Your domain requests</caption> <caption class="sr-only">Your domain requests</caption>
<thead> <thead>
<tr> <tr>
<th data-sortable="requested_domain" scope="col" role="columnheader">Domain name</th> <th data-sortable="name" scope="col" role="columnheader">Domain name</th>
<th data-sortable="submission_date" scope="col" role="columnheader">Date submitted</th> <th data-sortable="submission_date" scope="col" role="columnheader">Date submitted</th>
<th data-sortable="status" scope="col" role="columnheader">Status</th> <th data-sortable="status" scope="col" role="columnheader">Status</th>
<th scope="col" role="columnheader"><span class="usa-sr-only">Action</span></th> <th scope="col" role="columnheader"><span class="usa-sr-only">Action</span></th>