Bugzilla – Attachment 119077 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), 11.75 KB, created by
Owen Leonard
on 2021-04-01 13:36:32 UTC
(
hide
)
Description:
Bug 27773: Hide unique holidays and exceptions which have passed
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2021-04-01 13:36:32 UTC
Size:
11.75 KB
patch
obsolete
>From 87a8e2b0769aa74861c0aaae19786fdd44731cfb 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. > >This patch also moves the inline CSS to a separate file because I want >to. > >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 | 160 +++++++++++++++++++++ > .../prog/en/modules/tools/holidays.tt | 78 ++++++---- > 2 files changed, 209 insertions(+), 29 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/css/calendar.css > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/calendar.css b/koha-tmpl/intranet-tmpl/prog/css/calendar.css >new file mode 100644 >index 0000000000..db046936ed >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/css/calendar.css >@@ -0,0 +1,160 @@ >+.controls { >+ display: block; >+ padding: 3px 0; >+} >+ >+.key { >+ padding: 3px; >+ white-space: nowrap; >+ line-height: 230%; >+ } >+ >+ .ui-datepicker { >+ font-size: 150%; >+ } >+ >+ .ui-datepicker th, >+ .ui-datepicker .ui-datepicker-title select { >+ font-size: 80%; >+ } >+ >+ .ui-datepicker td a { >+ padding: .5em; >+ } >+ >+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { >+ font-size: 80%; >+ } >+ >+ .key { >+ padding: 3px; >+ white-space: nowrap; >+ line-height: 230%; >+ } >+ >+ .normalday { >+ background-color: #EDEDED; >+ color: Black; >+ border: 1px solid #BCBCBC; >+ } >+ >+ .exception { >+ background-color: #b3d4ff; >+ color: Black; >+ border: 1px solid #BCBCBC; >+ } >+ >+ .holiday { >+ background-color: #ffaeae; >+ color: Black; >+ border: 1px solid #BCBCBC; >+ } >+ >+ .repeatableweekly { >+ background-color: #FFFF99; >+ color: Black; >+ border: 1px solid #BCBCBC; >+ } >+ >+ .repeatableyearly { >+ background-color: #FFCC66; >+ color: Black; >+ border: 1px solid #BCBCBC; >+ } >+ >+ td.exception a.ui-state-default { >+ background: #b3d4ff none; >+ color: Black; >+ border: 1px solid #BCBCBC; >+ } >+ >+ td.holiday a.ui-state-default { >+ background: #ffaeae none; >+ color: Black; >+ border: 1px solid #BCBCBC; >+ } >+ >+ td.repeatableweekly a.ui-state-default { >+ background: #FFFF99 none; >+ color: Black; >+ border: 1px solid #BCBCBC; >+ } >+ >+ td.repeatableyearly a.ui-state-default { >+ background: #FFCC66 none; >+ color: Black; >+ border: 1px solid #BCBCBC; >+ } >+ >+ .information { >+ z-index: 1; >+ background-color: #DCD2F1; >+ width: 300px; >+ display: none; >+ border: 1px solid #000000; >+ color: #000000; >+ font-size: 8pt; >+ font-weight: bold; >+ background-color: #FFD700; >+ cursor: pointer; >+ padding: 2px; >+ } >+ >+ .panel { >+ z-index: 1; >+ display: none; >+ border: 3px solid #CCC; >+ padding: 3px; >+ margin-top: .3em; >+ background-color: #FEFEFE; >+ } >+ >+ fieldset.brief { >+ border: 0; >+ margin-top: 0; >+ } >+ >+ #showHoliday { >+ margin: .5em 0; >+ } >+ >+ h1 select { >+ width: 20em; >+ } >+ >+ fieldset.brief ol { >+ font-size: 100%; >+ } >+ >+ fieldset.brief li, >+ fieldset.brief li.radio { >+ padding: 0.2em 0; >+ } >+ >+ .help { >+ margin: .3em 0; >+ border: 1px solid #EEE; >+ padding: .3em .7em; >+ font-size: 90%; >+ } >+ >+ #holidayweeklyrepeatable, >+ #holidaysyearlyrepeatable, >+ #holidaysunique, >+ #holidayexceptions { >+ font-size: 90%; >+ margin-bottom: 1em; >+ } >+ >+ .calendar td, >+ .calendar th, >+ .calendar .button, >+ .calendar tbody .day { >+ padding: .7em; >+ font-size: 110%; >+ } >+ >+ .calendar { >+ width: auto; >+ border: 0; >+ } >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 8aefa2458f..fff6a6948e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >@@ -5,25 +5,7 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Tools › [% Branches.GetName( branch ) | html %] calendar</title> > [% INCLUDE 'doc-head-close.inc' %] >-<style> .key { padding : 3px; white-space:nowrap; line-height:230%; } >-.ui-datepicker { font-size : 150%; } >-.ui-datepicker th, .ui-datepicker .ui-datepicker-title select { font-size : 80%; } >-.ui-datepicker td a { padding : .5em; } >-.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { font-size : 80%; } >-.key { padding : 3px; white-space:nowrap; line-height:230%; } >-.normalday { background-color : #EDEDED; color : Black; border : 1px solid #BCBCBC; } >-.exception { background-color : #b3d4ff; color : Black; border : 1px solid #BCBCBC; } >-.holiday { background-color : #ffaeae; color : Black; border : 1px solid #BCBCBC; } >-.repeatableweekly { background-color : #FFFF99; color : Black; border : 1px solid #BCBCBC; } >-.repeatableyearly { background-color : #FFCC66; color : Black; border : 1px solid #BCBCBC; } >-td.exception a.ui-state-default { background: #b3d4ff none; color : Black; border : 1px solid #BCBCBC; } >-td.holiday a.ui-state-default { background: #ffaeae none; color : Black; border : 1px solid #BCBCBC; } >-td.repeatableweekly a.ui-state-default { background: #FFFF99 none; color : Black; border : 1px solid #BCBCBC; } >-td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Black; border : 1px solid #BCBCBC; } >-.information { z-index : 1; background-color : #DCD2F1; width : 300px; display : none; border : 1px solid #000000; color : #000000; font-size : 8pt; font-weight : bold; background-color : #FFD700; cursor : pointer; padding : 2px; } >-.panel { z-index : 1; display : none; border : 3px solid #CCC; padding : 3px; margin-top: .3em; background-color: #FEFEFE; } fieldset.brief { border : 0; margin-top: 0; } >-#showHoliday { margin : .5em 0; } h1 select { width: 20em; } fieldset.brief ol { font-size:100%; } fieldset.brief li, fieldset.brief li.radio { padding:0.2em 0; } .help { margin:.3em 0;border:1px solid #EEE;padding:.3em .7em; font-size : 90%; } #holidayweeklyrepeatable, #holidaysyearlyrepeatable, #holidaysunique, #holidayexceptions { font-size : 90%; margin-bottom : 1em;} .calendar td, .calendar th, .calendar .button, .calendar tbody .day { padding : .7em; font-size: 110%; } .calendar { width: auto; border : 0; } >-</style> >+[% Asset.css("css/calendar.css") %] > </head> > <body id="tools_holidays" class="tools"> > [% INCLUDE 'header.inc' %] >@@ -246,16 +228,20 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl > <!-- 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> >+ <th class="exception title-string">Date</th> > <th class="exception">Title</th> > <th class="exception">Description</th> > </tr> > </thead> > <tbody> > [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %] >- <tr> >+ <tr data-date="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]"> > <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE | uri %]"><span title="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]">[% EXCEPTION_HOLIDAYS_LOO.DATE | html %]</span></a></td> > <td>[% EXCEPTION_HOLIDAYS_LOO.TITLE | html %]</td> > <td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | html %]</td> >@@ -294,9 +280,9 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl > <thead> > <tr> > [% IF ( dateformat == "metric" ) %] >- <th class="repeatableyearly">Day/month</th> >+ <th class="repeatableyearly title-string">Day/month</th> > [% ELSE %] >- <th class="repeatableyearly">Month/day</th> >+ <th class="repeatableyearly title-string">Month/day</th> > [% END %] > <th class="repeatableyearly">Title</th> > <th class="repeatableyearly">Description</th> >@@ -316,17 +302,21 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl > > [% 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> >- <th class="holiday">Date</th> >+ <th class="holiday title-string">Date</th> > <th class="holiday">Title</th> > <th class="holiday">Description</th> > </tr> > </thead> > <tbody> > [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %] >-<tr> >+<tr data-date="[% HOLIDAYS_LOO.DATE_SORT | html %]"> > <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&calendardate=[% HOLIDAYS_LOO.DATE | uri %]"><span title="[% HOLIDAYS_LOO.DATE_SORT | html %]">[% HOLIDAYS_LOO.DATE | html %]</span></a></td> > <td>[% HOLIDAYS_LOO.TITLE | html %]</td> > <td>[% HOLIDAYS_LOO.DESCRIPTION.replace('\\\r\\\n', '<br />') | html %]</td> >@@ -498,6 +488,25 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl > } > }; > >+ /* 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(); >@@ -512,13 +521,24 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl > "sDom": 't', > "bPaginate": false > })); >- $("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").dataTable($.extend(true, {}, dataTablesDefaults, { >+ var tables = $("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").DataTable($.extend(true, {}, dataTablesDefaults, { > "sDom": 't', >- "aoColumns": [ >- { "sType": "title-string" },null,null >+ "aoColumnDefs": [ >+ { "type": "title-string", "targets" : [ "title-string" ] }, > ], >- "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