Bugzilla – Attachment 119310 Details for
Bug 27773
Hide unique holidays and exceptions which have passed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27773: Hide unique holidays and exceptions which have passed
Bug-27773-Hide-unique-holidays-and-exceptions-whic.patch (text/plain), 5.05 KB, created by
Owen Leonard
on 2021-04-07 17:43:57 UTC
(
hide
)
Description:
Bug 27773: Hide unique holidays and exceptions which have passed
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2021-04-07 17:43:57 UTC
Size:
5.05 KB
patch
obsolete
>From d9a682d1c6c35f97ed65e3603bf62de9d8d3f33e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 24 Feb 2021 01:09:33 +0000 >Subject: [PATCH] Bug 27773: Hide unique holidays and exceptions which have > passed > >This patch modifies the display of unique holidays and holiday >exceptions so that dates in the past are hidden by default. A >corresponding "Show past entries" checkbox can be checked to show the >hidden entries. > >To test you should have some unique holidays and holiday exceptions in >your system from the past and in the future. > > - Apply the patch and go to Tools -> Calendar > - In the tables of existing holidays, check that no dates in the past > appear in the "Exceptions" or "Unique holidays" tables. > - Checking the checkbox at the top of each of these tables should > trigger the display of the hidden rows. >--- > koha-tmpl/intranet-tmpl/prog/css/calendar.css | 5 +++ > .../prog/en/modules/tools/holidays.tt | 46 ++++++++++++++++++++-- > 2 files changed, 47 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/calendar.css b/koha-tmpl/intranet-tmpl/prog/css/calendar.css >index fd81d6fbed..b0fb065922 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/calendar.css >+++ b/koha-tmpl/intranet-tmpl/prog/css/calendar.css >@@ -1,3 +1,8 @@ >+.controls { >+ display: block; >+ padding: 3px 0; >+} >+ > .key { > padding: 3px; > white-space: nowrap; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >index ca8e20c808..c473112ade 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >@@ -242,6 +242,10 @@ > <!-- this will probably always have the least amount of data --> > [% IF ( EXCEPTION_HOLIDAYS_LOOP ) %] > <h3>Exceptions</h3> >+ <label class="controls"> >+ <input type="checkbox" name="show_past" id="show_past_holidayexceptions" class="show_past" /> >+ Show past entries >+ </label> > <table id="holidayexceptions"> > <thead><tr> > <th class="exception">Date</th> >@@ -251,7 +255,7 @@ > </thead> > <tbody> > [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %] >- <tr> >+ <tr data-date="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]"> > <td data-order="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]"> > <a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE | uri %]"> > [% EXCEPTION_HOLIDAYS_LOO.DATE | html %] >@@ -318,6 +322,10 @@ > > [% IF ( HOLIDAYS_LOOP ) %] > <h3>Unique holidays</h3> >+<label class="controls"> >+ <input type="checkbox" name="show_past" id="show_past_holidaysunique" class="show_past" /> >+ Show past entries >+</label> > <table id="holidaysunique"> > <thead> > <tr> >@@ -328,7 +336,7 @@ > </thead> > <tbody> > [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %] >-<tr> >+<tr data-date="[% HOLIDAYS_LOO.DATE_SORT | html %]"> > <td data-order="[% HOLIDAYS_LOO.DATE_SORT | html %]"> > <a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&calendardate=[% HOLIDAYS_LOO.DATE | uri %]"> > [% HOLIDAYS_LOO.DATE | html %] >@@ -504,6 +512,25 @@ > } > }; > >+ /* 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 table = settings.nTable.id; >+ var row = $(settings.aoData[index].nTr); >+ if( row.hasClass("date_past") && !$("#show_past_" + table ).prop("checked") ){ >+ return false; >+ } else { >+ return true; >+ } >+ } >+ ); >+ >+ // Create current date variable >+ var date = new Date(); >+ var datestring = date.toISOString().substring(0, 10); >+ > $(document).ready(function() { > > $(".hint").hide(); >@@ -518,10 +545,21 @@ > "sDom": 't', > "bPaginate": false > })); >- $("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").dataTable($.extend(true, {}, dataTablesDefaults, { >+ var tables = $("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").DataTable($.extend(true, {}, dataTablesDefaults, { > "sDom": 't', >- "bPaginate": false >+ "bPaginate": false, >+ "createdRow": function( row, data, dataIndex ) { >+ var holiday = $(row).data("date"); >+ if( holiday < datestring ){ >+ $(row).addClass("date_past"); >+ } >+ } > })); >+ >+ $(".show_past").on("change", function(){ >+ tables.draw(); >+ }); >+ > $("a.helptext").click(function(){ > $(this).parent().find(".hint").toggle(); return false; > }); >-- >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 27773
:
117260
|
119077
|
119310
|
119552