Bugzilla – Attachment 129972 Details for
Bug 29949
Remove use of title-numeric sorting routine from OPAC datatables JS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29949: Remove use of title-numeric sorting routine from OPAC datatables JS
Bug-29949-Remove-use-of-title-numeric-sorting-rout.patch (text/plain), 5.85 KB, created by
Katrin Fischer
on 2022-01-29 23:54:24 UTC
(
hide
)
Description:
Bug 29949: Remove use of title-numeric sorting routine from OPAC datatables JS
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-01-29 23:54:24 UTC
Size:
5.85 KB
patch
obsolete
>From 5f08d7d7a7244d52bbe1ce08dfad27f4b1f5b085 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 26 Jan 2022 12:18:55 +0000 >Subject: [PATCH] Bug 29949: Remove use of title-numeric sorting routine from > OPAC datatables JS > >This patch removes the use of a specific "title-numeric" sorting routine >from the DataTables configuration of the "Most popular" table. We can >use a "data-order" attribute instead. > >The patch also removes the now unused code from our custom DataTables JS >file in both the OPAC and the staff interface (where it was unused). > >To test, apply the patch and make sure the OpacTopissue system >preference is enabled. > >- In the OPAC, view the "Most popular" page. >- Change the filter settings, if necessary, to get multiple results. >- In the results table, confirm that sorting by number of checkouts > still works correctly. > >A search of the code for instances of "title-numeric" should return only >one in a comment in the official DataTables library. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 27 ------------------- > .../bootstrap/en/modules/opac-topissues.tt | 9 +++---- > .../opac-tmpl/bootstrap/js/datatables.js | 27 ------------------- > 3 files changed, 4 insertions(+), 59 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index bae315cf04..c95a972328 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -314,33 +314,6 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { > } > } ); > >-/* Plugin to allow sorting on numeric data stored in a span's title attribute >- * >- * Ex: <td><span title="[% decimal_number_that_JS_parseFloat_accepts %]"> >- * [% formatted currency %] >- * </span></td> >- * >- * In DataTables config: >- * "aoColumns": [ >- * { "sType": "title-numeric" }, >- * ] >- * http://datatables.net/plug-ins/sorting#hidden_title >- */ >-jQuery.extend( jQuery.fn.dataTableExt.oSort, { >- "title-numeric-pre": function ( a ) { >- var x = a.match(/title="*(-?[0-9\.]+)/)[1]; >- return parseFloat( x ); >- }, >- >- "title-numeric-asc": function ( a, b ) { >- return ((a < b) ? -1 : ((a > b) ? 1 : 0)); >- }, >- >- "title-numeric-desc": function ( a, b ) { >- return ((a < b) ? 1 : ((a > b) ? -1 : 0)); >- } >-} ); >- > (function() { > > /* Plugin to allow text sorting to ignore articles >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt >index 8129451dd4..3cdc6a417a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt >@@ -88,7 +88,7 @@ > <tr> > <th class="anti-the">Title</th> > <th>[% IF ( ccodesearch ) %]Collection[% ELSE %]Item type[% END %]</th> >- <th class="title-num">Checkouts</th> >+ <th>Checkouts</th> > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] > <th class="NoSort"> </th> > [% END %] >@@ -118,9 +118,9 @@ > [% ItemTypes.GetDescription(result.itemtype) | html %] > [% END %] > </td> >- <td> >+ <td data-order="[% result.count | html %]"> > <span class="tdlabel">Checkouts: </span> >- <span title="[% result.count | html %]">[% result.count | html %]</span> >+ [% result.count | html %] > </td> > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] > <td> >@@ -153,8 +153,7 @@ > "sorting": [[2, "desc"]], > "columnDefs": [ > { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] }, >- { "type": "anti-the", "targets" : [ "anti-the" ] }, >- { "type": "title-numeric", "targets" : [ "title-num"] }, >+ { "type": "anti-the", "targets" : [ "anti-the" ] } > ] > })); > }); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >index 5d3a543942..ea0f3773d2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >@@ -70,33 +70,6 @@ $.fn.dataTable.ext.buttons.clearFilter = { > } > }; > >-/* Plugin to allow sorting on numeric data stored in a span's title attribute >- * >- * Ex: <td><span title="[% decimal_number_that_JS_parseFloat_accepts %]"> >- * [% formatted currency %] >- * </span></td> >- * >- * In DataTables config: >- * "aoColumns": [ >- * { "sType": "title-numeric" }, >- * ] >- * http://datatables.net/plug-ins/sorting#hidden_title >- */ >-jQuery.extend( jQuery.fn.dataTableExt.oSort, { >- "title-numeric-pre": function ( a ) { >- var x = a.match(/title="*(-?[0-9\.]+)/)[1]; >- return parseFloat( x ); >- }, >- >- "title-numeric-asc": function ( a, b ) { >- return ((a < b) ? -1 : ((a > b) ? 1 : 0)); >- }, >- >- "title-numeric-desc": function ( a, b ) { >- return ((a < b) ? 1 : ((a > b) ? -1 : 0)); >- } >-} ); >- > (function() { > > /* Plugin to allow text sorting to ignore articles >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29949
:
129824
|
129836
| 129972