Bugzilla – Attachment 128510 Details for
Bug 29552
flatpickr quick shortcuts should be 'Disabled' for invalid dates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29552: Flatpickr - Disable shortcut buttons if inactive
Bug-29552-Flatpickr---Disable-shortcut-buttons-if-.patch (text/plain), 2.45 KB, created by
Martin Renvoize (ashimema)
on 2021-12-14 14:53:08 UTC
(
hide
)
Description:
Bug 29552: Flatpickr - Disable shortcut buttons if inactive
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-12-14 14:53:08 UTC
Size:
2.45 KB
patch
obsolete
>From 3bcaf4bf14e6d0240df0b4d7f9e032165895a7d7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 23 Nov 2021 14:17:09 +0100 >Subject: [PATCH] Bug 29552: Flatpickr - Disable shortcut buttons if inactive > >If one of the buttons is not relevant we should disable it and mark is >as such on the interface. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc | 10 ++++++++++ > 1 file changed, 10 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >index 2805870d10..8d3f4ee4ec 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >@@ -127,6 +127,7 @@ > $(".flatpickr").each(function(){ > let options = {}; > let refresh_max_date = 0; >+ let disable_buttons = []; > > if( $(this).data("flatpickr-futuredate") === true ) { > let original_date = $(this).val(); >@@ -143,13 +144,17 @@ > else { > options['minDate'] = new Date().fp_incr(1); > } >+ disable_buttons.push(0); /* Yesterday */ > } > if( $(this).data("flatpickr-pastinclusive") === true ) { > options['maxDate'] = new Date(); /* Not today or hh:mm will be 00:00 */ > refresh_max_date = 1; >+ disable_buttons.push(2); /* Tomorrow */ > } > if( $(this).data("flatpickr-pastdate") === true ) { > options['maxDate'] = new Date().fp_incr(-1); >+ disable_buttons.push(1); /* Today */ >+ disable_buttons.push(2); /* Tomorrow */ > } > if ( $(this).data('flatpickr-enable-time') === true ) { > options['enableTime'] = true; >@@ -157,6 +162,11 @@ > } > > let fp = $(this).flatpickr(options); >+ >+ $(disable_buttons).each(function(index, value){ >+ $(fp.calendarContainer).find(".shortcut-buttons-flatpickr-button[data-index='"+value+"']").prop("disabled", "disabled").css("color", "#999"); >+ }); >+ > if ( refresh_max_date ) { > /* Refresh the maxDate every 30 secondes to make sure the user will not > be stuck with the minute passed. >-- >2.20.1
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 29552
:
127954
|
128221
|
128222
|
128510
|
128511
|
128512
|
128729
|
128806
|
128807
|
128808
|
128809
|
128810
|
128811