Bugzilla – Attachment 174562 Details for
Bug 37398
Initialize a datepicker on all date/datetime fields when adding/editing items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37398: Add set to today function to calendar.inc
Bug-37398-Add-set-to-today-function-to-calendarinc.patch (text/plain), 3.33 KB, created by
Marcel de Rooy
on 2024-11-15 10:42:02 UTC
(
hide
)
Description:
Bug 37398: Add set to today function to calendar.inc
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-11-15 10:42:02 UTC
Size:
3.33 KB
patch
obsolete
>From 7a995eade40d04ca2860ec594cf7edec49d3f1b4 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Mon, 23 Sep 2024 16:23:13 +0000 >Subject: [PATCH] Bug 37398: Add set to today function to calendar.inc >Content-Type: text/plain; charset=utf-8 > >To test: >1. Try editing some items with a empty value in the flatpickr. >2. Make sure the empty date fields get a date set to today when you click on the empty field. >3. Try a datetime field, making sure the datetime is correctly set. > >Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc | 9 +++++++++ > .../intranet-tmpl/prog/en/includes/html_helpers.inc | 4 ++-- > 2 files changed, 11 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >index edb7268c6b..e56932f88f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >@@ -133,6 +133,15 @@ > } > } > }, >+ onOpen: function( selectedDates, dateText, instance) { >+ var thisInput = instance.input; >+ let set_to_today = $(thisInput).data('flatpickr-set-to-today'); >+ if ( set_to_today ) { >+ if ( thisInput.value === '' ) { >+ instance.setDate( new Date() ); >+ } >+ } >+ }, > onClose: function( selectedDates, dateText, instance) { > validate_date( dateText, instance ); > var thisInput = instance.input; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >index 14849ffe11..50d618f392 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -167,9 +167,9 @@ > <textarea id="[%- mv.id | html -%]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %]" rows="5" cols="64" >[% mv.value | html %]</textarea> > [% END %] > [% ELSIF ( mv.type == 'date_field' ) %] >- <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" class="flatpickr" /> >+ <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" class="flatpickr" data-flatpickr-set-to-today="true" /> > [% ELSIF ( mv.type == 'datetime_field' ) %] >- <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" data-flatpickr-enable-time="true" /> >+ <input type="text" id="[% mv.id | html %]" name="[% kohafield | html %]" class="input_marceditor [% kohafield | html %] flatpickr" value="[% mv.value | html %]" data-flatpickr-enable-time="true" data-flatpickr-set-to-today="true" /> > [% END %] > > [% IF subfield.kohafield == 'items.more_subfields_xml' %] >-- >2.39.5
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 37398
:
171416
|
171417
|
171419
|
171420
|
171421
|
171422
|
171423
|
171424
|
171881
|
171882
|
171919
|
171963
|
172187
|
172188
|
172189
|
172190
|
172191
|
172192
|
172193
|
172194
|
172195
|
172196
|
174558
|
174559
|
174560
|
174561
| 174562 |
174563
|
174564
|
174565
|
174566
|
176020