Bug 9916

Summary: Use DataTables in the OPAC
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: gmcharlt, kyle, srdjan
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Medium patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 27168    
Bug Blocks:    
Attachments: Bug 9916 - Use DataTables in the OPAC
Bug 9916 - Use DataTables in the OPAC
[SIGNED-OFF] Bug 9916 - Use DataTables in the OPAC
Bug 9916 - Use DataTables in the OPAC
[PASSED QA] Bug 9916 - Use DataTables in the OPAC

Description Owen Leonard 2013-03-24 13:03:31 UTC
Many tables in the OPAC are sorted with the old tablesorter plugin. They should use DataTables instead. This implementation of DataTables should use a minimal configuration, compared to the staff client, because of the limited kinds of functionality required in the OPAC and the need for efficiency.
Comment 1 Owen Leonard 2013-07-25 19:42:06 UTC Comment hidden (obsolete)
Comment 2 Srdjan Jankovic 2013-07-31 07:06:07 UTC
On opac-serial-issues.pl?selectview=full I got "currentYear is not defined". Is that just my setup?
Comment 3 Owen Leonard 2013-07-31 13:14:01 UTC
(In reply to Srdjan Jankovic from comment #2)
> On opac-serial-issues.pl?selectview=full I got "currentYear is not defined".

Thanks for testing Srdjan. Where did you see that error?
Comment 4 Owen Leonard 2013-07-31 13:26:08 UTC
Oh I see: If you navigate directly to "/cgi-bin/koha/opac-serial-issues.pl?selectview=full" without coming to it from an existing subscription you do get that error. You have to search for a biblio with a subscription and click the "subscriptions" tab. Click "more details" at the bottom, then the "full history" tab.

There should be a biblionumber parameter:

/cgi-bin/koha/opac-serial-issues.pl?selectview=full&biblionumber=XXX
Comment 5 Srdjan Jankovic 2013-08-01 01:31:12 UTC Comment hidden (obsolete)
Comment 6 Srdjan Jankovic 2013-08-01 01:32:27 UTC Comment hidden (obsolete)
Comment 7 Srdjan Jankovic 2013-08-01 01:39:22 UTC
I got
fatal: /tmp/RDJ3G9: 657: patch contains a line longer than 998 characters
warning: no patches were sent

Something to worry about?
Comment 8 Owen Leonard 2013-08-01 11:31:22 UTC
(In reply to Srdjan Jankovic from comment #7)
> fatal: /tmp/RDJ3G9: 657: patch contains a line longer than 998 characters
> warning: no patches were sent

This is a common problem if you try to use git to send an patch that contains a minified JavaScript file. If it was something you needed to get to the patches mailing list you'd have to mail it by hand.
Comment 9 Srdjan Jankovic 2013-08-01 23:22:36 UTC
Ok, so you want me to email it separately? I mean how important it is?
Comment 10 Kyle M Hall 2013-08-16 16:35:57 UTC Comment hidden (obsolete)
Comment 11 Katrin Fischer 2013-08-18 12:18:18 UTC
Created attachment 20435 [details] [review]
[PASSED QA] Bug 9916 - Use DataTables in the OPAC

The OPAC still uses the old tablesorter plugin which isn't being
actively maintained. We use DataTables in the staff client and should in
the OPAC too. The plugin was added a while ago but never implemented on
any pages. This patch upgrades the plugin to the latest version and
places it in opac-tmpl/lib for cross-theme access. The patch implements
DataTables on all pages which previously used the tablesorter plugin.

The old tablesorter plugin is removed.

The customized DataTable configuration script, datatables.js, has been
trimmed-down from the staff client version in order to limit it to only
that functionality required in the OPAC.

Sorting based on date is done based on the data's enclosing <span> title
attribute as it is in the staff client:

<span title=" [% iso date %]">[% date | $KohaDates %]</span>

Slight modifications to Serials.pm and opac-search-history.pl have been
made to accommodate this change.

To test, view each page in the OPAC which uses JS-based table sorting:

- The bibliographic detail page
- The cart
- The search history page
- The suggestions page
- The tags page (logged in as a user who has entered tags)
- The "most popular" page (opac-topissues.pl)
- The logged in user summary page (opac-user.pl)
- The subscription "full history" page (opac-serial-issues.pl?selectview=full)
- The self-checkout main page (with existing checkouts)

Table sorting should work correctly on all pages in both the prog and
ccsr themes. Sorting should work for dates whatever your dateformat
system preference setting. Tables listing titles should exclude articles
("a," "an," and "the" in English) when sorting.

Also test the serial collection page in the staff client, which is
affected by the change to Serials.pm. Confirm that dates are displayed
and sorted correctly.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised!

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works really nicely on all pages.
Comment 12 Galen Charlton 2013-08-19 14:58:27 UTC
Pushed to master, along with some follow-ups to set the default sort order on some pages back to where it was before this patch.

Thanks, Owen!