From 2c45a84bb2706d139c9f904c7ab9bfa3156e2655 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 9 May 2019 16:55:00 +0000 Subject: [PATCH] Bug 22888: Use DataTables for Koha news table filtering This patch modifies the Koha news page so that filtering the table of news is done using DataTables' built-in search functionality. This allows for the table to be filtered without requiring a reload of the page. The patch also moves the table filter into a sidebar form and adds a keyword field. A minor change has been made to the global CSS to improve the display of the form in the sidebar. To test, apply the patch and rebuild the staff client CSS. - Go to Tools -> News. - Test the various table filter options: keyword, display location, and library. Confirm that all work as expected. - Changes to the keyword search text should be reflected in the search field at the top of the table, and vice versa. - Changes to the sidebar filter should trigger the correct state of the "Clear filter" button at the top of the news table (enabled or disabled). --- .../intranet-tmpl/prog/css/src/staff-global.scss | 2 +- .../prog/en/modules/tools/koha-news.tt | 121 +++++++++++++++------ tools/koha-news.pl | 2 +- 3 files changed, 91 insertions(+), 34 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 0ac6b70..5075364 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -155,7 +155,7 @@ aside { fieldset { &.brief { - margin: 0; + margin: 0 0 1em 0; padding: .4em .7em; fieldset { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt index 1d36f44..54aa9c1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt @@ -100,24 +100,6 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]
Cancel
[% ELSE %] -
-
- - - - - -
-
[% IF ( opac_news_count ) %]
@@ -186,6 +168,35 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]
@@ -198,8 +209,37 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] [% IF ( opac_news_count ) %] [% INCLUDE 'datatables.inc' %] [% END %] @@ -262,7 +319,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] [% BLOCK lang_locations %] [% IF ( language == "" ) %] - + [% ELSE %] [% END %] diff --git a/tools/koha-news.pl b/tools/koha-news.pl index 7c20b5d..b90a8c4 100755 --- a/tools/koha-news.pl +++ b/tools/koha-news.pl @@ -144,7 +144,7 @@ elsif ( $op eq 'del' ) { else { - my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang, $branchcode ); + my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, undef, undef ); foreach my $new ( @$opac_news ) { next unless $new->{'expirationdate'}; -- 2.1.4