@@ -, +, @@ - Apply the patch and go to Tools -> News - The table of news items as it initially appears should not include any expired news items. - In the sidebar, check the "Show expired" checkbox. - The expired news items should now appear. --- .../prog/en/modules/tools/koha-news.tt | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt @@ -239,6 +239,11 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %] +
  • + +
  • @@ -291,6 +296,20 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] } } + /* Custom table search configuration: If a table row + has an "expired" class, hide it UNLESS the + show_expired checkbox is checked */ + $.fn.dataTable.ext.search.push( + function( settings, searchData, index, rowData, counter ) { + var row = $(settings.aoData[index].nTr); + if( row.hasClass("expired") && !$("#show_expired").prop("checked") ){ + return false; + } else { + return true; + } + } + ); + $(document).ready(function() { var newst = $("#newst").DataTable($.extend(true, {}, dataTablesDefaults, { "order": [[ 4, "desc" ]], @@ -315,6 +334,11 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %] } }); + $("#show_expired").on("change", function(){ + /* redraw the DataTable according to the custom search function */ + newst.draw(); + }); + newst.on( 'search.dt', function () { var term = newst.search(); $("#news_keyword").val( term ); --