Bug 24093: Sorting indicators broken on list contents view

This patch updates the table markup for the lists contents view so that
the table sort state is correctly indicated by arrows in the table
headers. The markup changes allow the standard DataTables CSS to apply
to this table even though it is not a DataTable.

To test, apply the patch, go to Lists, and view any list with multiple
titles attached.

 - The list should be sorted by default according to the list's
   settings, and the arrow in the header row should correctly reflect
   the sorting column and direction.
 - Test re-sorting the table by each of the different sortable columns,
   confirming each time that the sorting arrows are correct.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Owen Leonard 2019-11-22 18:41:28 +00:00 committed by Martin Renvoize
parent 770f24d4f7
commit e9163adf3f
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -159,44 +159,42 @@
</div>
[% END %]
<table id="searchresults">
<table id="searchresults" class="dataTable">
<thead>
<tr>
[% IF ( itemsloop ) %]<th class="checkall">&nbsp;</th>[% END %]
[% UNLESS ( item_level_itypes ) %]<th>Item type</th>[% END %]
<th>
[% IF sortfield == 'title' %]
<th class="sorting_[% direction | html %]">
[% ELSE %]
<th class="sorting">
[% END %]
<a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]&amp;sortfield=title&amp;direction=[% IF sortfield != 'title' %]asc[% ELSE %][% new_direction | uri %][% END %]">Title</a>
[% IF sortfield == 'title' %]
<img src="[% interface | html %]/[% theme | html %]/img/[% direction | html %].gif" alt="[% direction | html %] sort" />
[% ELSE %]
<img src="[% interface | html %]/[% theme | html %]/img/ascdesc.gif" alt="" />
[% END %]
</th>
<th>
[% IF sortfield == 'author' %]
<th class="sorting_[% direction | html %]">
[% ELSE %]
<th class="sorting">
[% END %]
<a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]&amp;sortfield=author&amp;direction=[% IF sortfield != 'author' %]asc[% ELSE %][% new_direction | uri %][% END %]">Author</a>
[% IF sortfield == 'author' %]
<img src="[% interface | html %]/[% theme | html %]/img/[% direction | html %].gif" alt="[% direction | html %] sort" />
[% ELSE %]
<img src="[% interface | html %]/[% theme | html %]/img/ascdesc.gif" alt="" />
[% END %]
</th>
<th>
<a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]&amp;sortfield=dateadded&amp;direction=[% IF sortfield != 'dateadded' %]asc[% ELSE %][% new_direction | uri %][% END %]">Date added</a>
[% IF sortfield == 'dateadded' %]
<img src="[% interface | html %]/[% theme | html %]/img/[% direction | html %].gif" alt="[% direction | html %] sort" />
[% ELSE %]
<img src="[% interface | html %]/[% theme | html %]/img/ascdesc.gif" alt="" />
[% END %]
</th>
<th>
[% IF sortfield == 'dateadded' %]
<th class="sorting_[% direction | html %]">
[% ELSE %]
<th class="sorting">
[% END %]
<a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]&amp;sortfield=dateadded&amp;direction=[% IF sortfield != 'dateadded' %]asc[% ELSE %][% new_direction | uri %][% END %]">Date added</a>
</th>
[% IF sortfield == 'itemcallnumber' %]
<th class="sorting_[% direction | html %]">
[% ELSE %]
<th class="sorting">
[% END %]
<a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]&amp;sortfield=itemcallnumber&amp;direction=[% IF sortfield != 'itemcallnumber' %]asc[% ELSE %][% new_direction | uri %][% END %]">Call number</a>
[% IF sortfield == 'itemcallnumber' %]
<img src="[% interface | html %]/[% theme | html %]/img/[% direction | html %].gif" alt="[% direction | html %] sort" />
[% ELSE %]
<img src="[% interface | html %]/[% theme | html %]/img/ascdesc.gif" alt="" />
[% END %]
</th>
</tr>
</thead>
[% FOREACH itemsloo IN itemsloop %]
<tr>
[% IF itemsloop %]