diff --git a/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm b/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm index 8228303c18..7336477775 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm @@ -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; diff --git a/templates/ContentGenerator/Instructor/ProblemSetList/set_list_table.html.ep b/templates/ContentGenerator/Instructor/ProblemSetList/set_list_table.html.ep index bb220e0a2c..7edc1ddaea 100644 --- a/templates/ContentGenerator/Instructor/ProblemSetList/set_list_table.html.ep +++ b/templates/ContentGenerator/Instructor/ProblemSetList/set_list_table.html.ep @@ -80,7 +80,15 @@ <% end =%> % for (@$fieldNames) { - + % my $ariaSort; + % if (!$c->{editMode} && $sortableFields->{$_}) { + % if ($c->{primarySortField} eq $_) { + % $ariaSort = $c->{primarySortOrder} eq 'ASC' ? 'ascending' : 'descending'; + % } elsif ($c->{secondarySortField} eq $_) { + % $ariaSort = 'other'; + % } + % } + > % if (!$c->{editMode} && $sortableFields->{$_}) {
<%= link_to $fieldHeaders{$_} => '#', class => 'sort-header', diff --git a/templates/ContentGenerator/Instructor/UserList/user_list.html.ep b/templates/ContentGenerator/Instructor/UserList/user_list.html.ep index 4e99bb6e7a..2efdb54840 100644 --- a/templates/ContentGenerator/Instructor/UserList/user_list.html.ep +++ b/templates/ContentGenerator/Instructor/UserList/user_list.html.ep @@ -14,7 +14,7 @@ <% end =%> - + ariaSortAttr('user_id') %>>
<%= link_to maketext('Login Name') => '#', class => 'sort-header', data => { sort_field => 'user_id' } =%> @@ -23,14 +23,14 @@ <%= maketext('Login Status') %> <%= maketext('Assigned Sets') %> - + ariaSortAttr('first_name') %>>
<%= link_to maketext('First Name') => '#', class => 'sort-header', data => { sort_field => 'first_name' } %> <%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'first_name' =%>
- + ariaSortAttr('last_name') %>>
<%= link_to maketext('Last Name') => '#', class => 'sort-header', data => { sort_field => 'last_name' } =%> @@ -38,14 +38,14 @@
<%= maketext('Email Link') %> - + ariaSortAttr('student_id') %>>
<%= link_to maketext('Student ID') => '#', class => 'sort-header', data => { sort_field => 'student_id' } =%> <%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'student_id' =%>
- + ariaSortAttr('status') %>>
<%= link_to maketext('Status') => '#', class => 'sort-header', data => { sort_field => 'status' } =%> @@ -53,28 +53,28 @@
<%= maketext('Accommodation Time Factor') %> - + ariaSortAttr('section') %>>
<%= link_to maketext('Section') => '#', class => 'sort-header', data => { sort_field => 'section' } =%> <%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'section' =%>
- + ariaSortAttr('recitation') %>>
<%= link_to maketext('Recitation') => '#', class => 'sort-header', data => { sort_field => 'recitation' } =%> <%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'recitation' =%>
- + ariaSortAttr('comment') %>>
<%= link_to maketext('Comment') => '#', class => 'sort-header', data => { sort_field => 'comment' } =%> <%= include 'ContentGenerator/Instructor/UserList/sort_button', field => 'comment' =%>
- + ariaSortAttr('permission') %>>
<%= link_to maketext('Permission Level') => '#', class => 'sort-header', data => { sort_field => 'permission' } =%>