Bugzilla – Attachment 43081 Details for
Bug 14940
opac-topissues.pl sort is broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14940: Fix sorting in opac-topissues.pl
PASSED-QA-Bug-14940-Fix-sorting-in-opac-topissuesp.patch (text/plain), 3.41 KB, created by
Katrin Fischer
on 2015-10-03 17:30:21 UTC
(
hide
)
Description:
[PASSED QA] Bug 14940: Fix sorting in opac-topissues.pl
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-10-03 17:30:21 UTC
Size:
3.41 KB
patch
obsolete
>From ece8777400bfab1ee79bbe1ce7eef3ffbaada56e Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 2 Oct 2015 09:25:18 +0200 >Subject: [PATCH] [PASSED QA] Bug 14940: Fix sorting in opac-topissues.pl >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >There is hidden text in "Checkouts" cells that prevent DataTables to >sort numerically. >This patch adds the 'title-numeric' sort plugin and use it in >opac-topissues.pl > >Column 'Checkouts' in Home > Most popular items sorts as expected >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../bootstrap/en/modules/opac-topissues.tt | 4 ++-- > koha-tmpl/opac-tmpl/bootstrap/js/datatables.js | 26 ++++++++++++++++++++++ > 2 files changed, 28 insertions(+), 2 deletions(-) > >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 3ec33af..9538e91 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt >@@ -87,7 +87,7 @@ > [% results_loo.description %] > [% END %] > </td> >- <td><span class="tdlabel">Checkouts: </span> [% results_loo.tot %]</td> >+ <td><span class="tdlabel">Checkouts: </span> <span title="[% results_loo.tot %]">[% results_loo.tot %]</span></td> > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]<td>[% IF Koha.Preference( 'RequestOnOpac' ) == 1 %][% UNLESS ( results_loo.norequests ) %]<a href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% results_loo.biblionumber %]">Place hold</a>[% END %][% END %]</td>[% END %] > </tr> > [% END %] >@@ -173,7 +173,7 @@ > "aoColumns": [ > { "sType": "anti-the" }, > null, >- null, >+ { "sType": "title-numeric" }, > [% IF ( opacuserlogin ) %]null,[% END %] > ] > })); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >index 5f0892d..a4c64a2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >@@ -55,6 +55,32 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { > } > } ); > >+/* Plugin to allow sorting numerically on data stored in a span's title attribute >+ * >+ * Ex: <td><span title="[% total %]">Total: [% total %]</span></td> >+ * >+ * In DataTables config: >+ * "aoColumns": [ >+ * { "sType": "title-numeric" } >+ * ] >+ * http://legacy.datatables.net/plug-ins/sorting#hidden_title >+ */ >+jQuery.extend( jQuery.fn.dataTableExt.oSort, { >+ "title-numeric-pre": function ( a ) { >+ console.log(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 >-- >1.9.1
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 14940
:
43047
|
43080
| 43081