From a1083587b235ac0d85e85a625944179e2c087785 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). Signed-off-by: Maryse Simard Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- .../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 333f9fda87..1f9ccf69b1 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 3d590e24ce..fe88908ff8 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 7c20b5d1eb..b90a8c4521 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.39.5