From 084e402e0910e2443a15fc6a0658994c2062a097 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 9 Oct 2014 10:01:16 -0400 Subject: [PATCH] Bug 10632 - Enable datatables for courses and course details in the OPAC We should use datatables for the courses and course items tables. This will make the tables sortable and searchable from the client side. Test Plan: 1) Apply this patch 2) View the courses in the OPAC, try sorting and searching 3) View the course details for a course, try sorting and searching the items. Signed-off-by: Owen Leonard Signing off, but have a follow-up to address some missing stuff. Signed-off-by: Jonathan Druart --- .../bootstrap/en/modules/opac-course-details.tt | 15 ++++++++++++-- .../bootstrap/en/modules/opac-course-reserves.tt | 23 +++++++++++----------- opac/opac-course-reserves.pl | 12 +++-------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt index 2bab190..6608394 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt @@ -6,7 +6,10 @@ [% INCLUDE 'doc-head-open.inc' %] [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Course reserves for [% course.course_name %] [% INCLUDE 'doc-head-close.inc' %] -[% BLOCK cssinclude %][% END %] +[% BLOCK cssinclude %] + +[% END %] + [% INCLUDE 'bodytag.inc' bodyid='opac-main' %] [% INCLUDE 'masthead.inc' %] @@ -43,7 +46,7 @@ [% IF ( course_reserves ) %] - +
@@ -86,4 +89,12 @@ [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] + [% INCLUDE 'datatables.inc' %] + [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-reserves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-reserves.tt index e68fa25..0fe898c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-reserves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-reserves.tt @@ -4,7 +4,10 @@ [% INCLUDE 'doc-head-open.inc' %] [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Courses [% INCLUDE 'doc-head-close.inc' %] -[% BLOCK cssinclude %][% END %] +[% BLOCK cssinclude %] + +[% END %] + [% INCLUDE 'bodytag.inc' bodyid='opac-main' %] [% INCLUDE 'masthead.inc' %] @@ -20,16 +23,6 @@

Courses

-
-
- -
- - -
- - -
Title
@@ -67,4 +60,12 @@ [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] + [% INCLUDE 'datatables.inc' %] + [% END %] diff --git a/opac/opac-course-reserves.pl b/opac/opac-course-reserves.pl index 6518ef4..b6a18ae 100755 --- a/opac/opac-course-reserves.pl +++ b/opac/opac-course-reserves.pl @@ -38,13 +38,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( } ); -my $search_on = $cgi->param('search_on'); +my $courses = SearchCourses( enabled => 'yes' ); -my $courses = SearchCourses( term => $search_on, enabled => 'yes' ); - -if ( @$courses == 1 ) { - print $cgi->redirect( "/cgi-bin/koha/opac-course-details.pl?course_id=" . $courses->[0]->{'course_id'} ); -} else { - $template->param( courses => $courses ); - output_html_with_http_headers $cgi, $cookie, $template->output; -} +$template->param( courses => $courses ); +output_html_with_http_headers $cgi, $cookie, $template->output; -- 2.1.0