From ce12202c866b4ee196a8c969cc2da4017a17c193 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Wed, 18 Sep 2019 18:30:25 +0200 Subject: [PATCH] Make it configurable if calendars shows week numbers or not (closes #333) --- changelog/52_UNRELEASED_2019-xx-xx.md | 1 + config-dist.php | 3 +++ public/viewjs/calendar.js | 2 +- public/viewjs/components/datetimepicker.js | 2 +- views/layout/default.blade.php | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog/52_UNRELEASED_2019-xx-xx.md b/changelog/52_UNRELEASED_2019-xx-xx.md index 48b7d2fc..e9f4dcbe 100644 --- a/changelog/52_UNRELEASED_2019-xx-xx.md +++ b/changelog/52_UNRELEASED_2019-xx-xx.md @@ -38,6 +38,7 @@ - Fixed that the Userfield type "Preset list" had always the caption "Product group" instead of the configured one (thanks @oncleben31) ### General improvements/fixes +- Added a new `config.php` setting `CALENDAR_SHOW_WEEK_OF_YEAR` to configure if calendars should show week numbers (defaults to `true`) - Improved the handling which entry page to use with disabled feature flags (thanks @nielstholenaar) - Boolean settings provided via environment variables (so the strings `true` and `false`) are now parsed correctly (thanks @mduret) - All uploaded pictures (currently for products and recipes) are now automatically downscaled to the appropriate size when serving them to improve page load times diff --git a/config-dist.php b/config-dist.php index 033a356d..9fbcbbd9 100644 --- a/config-dist.php +++ b/config-dist.php @@ -26,6 +26,9 @@ Setting('CULTURE', 'en'); # Needs to be a number where Sunday = 0, Monday = 1 and so forth Setting('CALENDAR_FIRST_DAY_OF_WEEK', ''); +# If calendars should show week numbers +Setting('CALENDAR_SHOW_WEEK_OF_YEAR', true); + # To keep it simple: grocy does not handle any currency conversions, # this here is used to format all money values, # so doesn't matter really matter, but should be the diff --git a/public/viewjs/calendar.js b/public/viewjs/calendar.js index 0745bdf5..6195ee31 100644 --- a/public/viewjs/calendar.js +++ b/public/viewjs/calendar.js @@ -11,7 +11,7 @@ $("#calendar").fullCalendar({ "center": "title", "right": "prev,next" }, - "weekNumbers": true, + "weekNumbers": Grocy.CalendarShowWeekNumbers, "firstDay": firstDay, "eventLimit": true, "eventSources": fullcalendarEventSources diff --git a/public/viewjs/components/datetimepicker.js b/public/viewjs/components/datetimepicker.js index 82e5dc91..366561eb 100644 --- a/public/viewjs/components/datetimepicker.js +++ b/public/viewjs/components/datetimepicker.js @@ -84,7 +84,7 @@ Grocy.Components.DateTimePicker.Init = function() showToday: true, showClose: true }, - calendarWeeks: true, + calendarWeeks: Grocy.CalendarShowWeekNumbers, maxDate: limitDate, locale: moment.locale(), defaultDate: startDate, diff --git a/views/layout/default.blade.php b/views/layout/default.blade.php index 8cd97671..824acc03 100644 --- a/views/layout/default.blade.php +++ b/views/layout/default.blade.php @@ -55,6 +55,7 @@ Grocy.Culture = '{{ GROCY_CULTURE }}'; Grocy.Currency = '{{ GROCY_CURRENCY }}'; Grocy.CalendarFirstDayOfWeek = '{{ GROCY_CALENDAR_FIRST_DAY_OF_WEEK }}'; + Grocy.CalendarShowWeekNumbers = {{ BoolToString(GROCY_CALENDAR_SHOW_WEEK_OF_YEAR) }}; Grocy.GettextPo = {!! $GettextPo !!}; Grocy.UserSettings = {!! json_encode($userSettings) !!}; Grocy.FeatureFlags = {!! json_encode($featureFlags) !!};