Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/WeBWorK/ContentGenerator/Instructor/UserList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1045,4 +1045,13 @@ sub exportUsersToCSV ($c, $fileName, @userIDsToExport) {
return;
}

sub ariaSortAttr ($c, $field) {
if ($c->{primarySortField} eq $field) {
return $c->{primarySortOrder} eq 'ASC' ? 'aria-sort="ascending"' : 'aria-sort="descending"';
} elsif ($c->{secondarySortField} eq $field || $c->{ternarySortField} eq $field) {
return 'aria-sort="other"';
}
return '';
}

1;
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,15 @@
<% end =%>
</th>
% for (@$fieldNames) {
<th id="<%= $_ %>_header">
% my $ariaSort;
% if (!$c->{editMode} && $sortableFields->{$_}) {
% if ($c->{primarySortField} eq $_) {
% $ariaSort = $c->{primarySortOrder} eq 'ASC' ? 'ascending' : 'descending';
% } elsif ($c->{secondarySortField} eq $_) {
% $ariaSort = 'other';
% }
% }
<th id="<%= $_ %>_header" <%== $ariaSort ? qq{aria-sort="$ariaSort"} : '' %>>
% if (!$c->{editMode} && $sortableFields->{$_}) {
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to $fieldHeaders{$_} => '#', class => 'sort-header',
Expand Down
18 changes: 9 additions & 9 deletions templates/ContentGenerator/Instructor/UserList/user_list.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<i class="fa-solid fa-check-double" aria-hidden="true"></i>
<% end =%>
</th>
<th>
<th <%== $c->ariaSortAttr('user_id') %>>
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to maketext('Login Name') => '#', class => 'sort-header',
data => { sort_field => 'user_id' } =%>
Expand All @@ -23,58 +23,58 @@
</th>
<th><%= maketext('Login Status') %></th>
<th><%= maketext('Assigned Sets') %></th>
<th>
<th <%== $c->ariaSortAttr('first_name') %>>
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to maketext('First Name') => '#', class => 'sort-header',
data => { sort_field => 'first_name' } %>
<%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'first_name' =%>
</div>
</th>
<th>
<th <%== $c->ariaSortAttr('last_name') %>>
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to maketext('Last Name') => '#', class => 'sort-header',
data => { sort_field => 'last_name' } =%>
<%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'last_name' =%>
</div>
</th>
<th><%= maketext('Email Link') %></th>
<th>
<th <%== $c->ariaSortAttr('student_id') %>>
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to maketext('Student ID') => '#', class => 'sort-header',
data => { sort_field => 'student_id' } =%>
<%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'student_id' =%>
</div>
</th>
<th>
<th <%== $c->ariaSortAttr('status') %>>
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to maketext('Status') => '#', class => 'sort-header',
data => { sort_field => 'status' } =%>
<%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'status' =%>
</div>
</th>
<th><%= maketext('Accommodation Time Factor') %></th>
<th>
<th <%== $c->ariaSortAttr('section') %>>
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to maketext('Section') => '#', class => 'sort-header',
data => { sort_field => 'section' } =%>
<%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'section' =%>
</div>
</th>
<th>
<th <%== $c->ariaSortAttr('recitation') %>>
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to maketext('Recitation') => '#', class => 'sort-header',
data => { sort_field => 'recitation' } =%>
<%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'recitation' =%>
</div>
</th>
<th>
<th <%== $c->ariaSortAttr('comment') %>>
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to maketext('Comment') => '#', class => 'sort-header',
data => { sort_field => 'comment' } =%>
<%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'comment' =%>
</div>
</th>
<th>
<th <%== $c->ariaSortAttr('permission') %>>
<div class="d-flex justify-content-between align-items-end gap-1">
<%= link_to maketext('Permission Level') => '#', class => 'sort-header',
data => { sort_field => 'permission' } =%>
Expand Down