optimizations (#2904)

* calc once, then re-use
* prevent invalid theme switch
* allow to turn off weekly-quick-entries by permissions
* remove 00:00 from date-times that likely do not need a time
* fix datepicker out of window
This commit is contained in:
Kevin Papst
2021-11-05 10:28:48 +01:00
committed by GitHub
parent c8854b0775
commit bd2fe32d5a
21 changed files with 64 additions and 45 deletions

View File

@@ -34,6 +34,7 @@ export default class KimaiDatePicker extends KimaiPlugin {
singleDatePicker: true,
showDropdowns: true,
autoUpdateInput: false,
drops: 'down',
locale: {
format: localeFormat,
firstDay: firstDow,
@@ -47,7 +48,8 @@ export default class KimaiDatePicker extends KimaiPlugin {
jQuery(this).on('show.daterangepicker', function (ev, picker) {
if (picker.element.offset().top - jQuery(window).scrollTop() + picker.container.outerHeight() + 30 > jQuery(window).height()) {
picker.drops = 'up';
// "up" is not possible here, because the code is triggered on many mobile phones and the picker then appears out of window
picker.drops = 'auto';
picker.move();
}
});

View File

@@ -52,6 +52,7 @@ export default class KimaiDateRangePicker extends KimaiPlugin {
autoUpdateInput: false,
autoApply: false,
linkedCalendars: true,
drops: 'down',
locale: {
separator: separator,
format: localeFormat,
@@ -68,7 +69,8 @@ export default class KimaiDateRangePicker extends KimaiPlugin {
jQuery(this).on('show.daterangepicker', function (ev, picker) {
if (picker.element.offset().top - jQuery(window).scrollTop() + picker.container.outerHeight() + 30 > jQuery(window).height()) {
picker.drops = 'up';
// "up" is not possible here, because the code is triggered on many mobile phones and the picker then appears out of window
picker.drops = 'auto';
picker.move();
}
});

View File

@@ -37,6 +37,7 @@ export default class KimaiDateTimePicker extends KimaiPlugin {
timePicker24Hour: is24hours,
showDropdowns: true,
autoUpdateInput: false,
drops: 'down',
locale: {
format: localeFormat,
firstDay: firstDow,
@@ -50,7 +51,8 @@ export default class KimaiDateTimePicker extends KimaiPlugin {
jQuery(this).on('show.daterangepicker', function (ev, picker) {
if (picker.element.offset().top - jQuery(window).scrollTop() + picker.container.outerHeight() + 30 > jQuery(window).height()) {
picker.drops = 'up';
// "up" is not possible here, because the code is triggered on many mobile phones and the picker then appears out of window
picker.drops = 'auto';
picker.move();
}
});