Bugzilla – Attachment 117739 Details for
Bug 27766
Hide expired news items by default
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27766: Hide expired news items by default
Bug-27766-Hide-expired-news-items-by-default.patch (text/plain), 3.42 KB, created by
Katrin Fischer
on 2021-03-04 15:49:36 UTC
(
hide
)
Description:
Bug 27766: Hide expired news items by default
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-03-04 15:49:36 UTC
Size:
3.42 KB
patch
obsolete
>From d52ac9f0c3138eb8e91f07b2c8904ba74f1dbe36 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 23 Feb 2021 17:25:47 +0000 >Subject: [PATCH] Bug 27766: Hide expired news items by default > >This patch modifies the news page in the staff interface so that expired >news items are hidden by default. A checkbox in the sidebar can be >checked to show the hidden rows. > >To test you should have multiple news items, some expired and some >unexpired. > > - 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. > >Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/tools/koha-news.tt | 24 ++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > >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 238ab054c0..d609997a40 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 >@@ -239,6 +239,11 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %] > </select> > </li> >+ <li> >+ <label> >+ <input type="checkbox" name="show_expired" id="show_expired" /> Show expired >+ </label> >+ </li> > </ol> > </fieldset> > </form> >@@ -291,6 +296,20 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > } > } > >+ /* 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 %]</div> > } > }); > >+ $("#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 ); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27766
:
117213
|
117214
| 117739