Added a new config.php setting CALENDAR_FIRST_DAY_OF_WEEK to be able to change the first day of a week used for calendar views (closes #256)

This commit is contained in:
Bernd Bestel
2019-07-06 20:19:21 +02:00
parent 1eb1aa8b11
commit 914dde4609
5 changed files with 23 additions and 2 deletions

View File

@@ -11,4 +11,5 @@
- Items can now be marked as "done" (new check mark button per item, when clicked, the item will be displayed greyed out, when clicked again the item will be displayed normally again) - Items can now be marked as "done" (new check mark button per item, when clicked, the item will be displayed greyed out, when clicked again the item will be displayed normally again)
- Improved that products can now also be consumed as spoiled from the stock overview page (option in the more/context menu per line) - Improved that products can now also be consumed as spoiled from the stock overview page (option in the more/context menu per line)
- Added a "consume this recipe"-button to the meal plan (and also a button to consume all recipes for a whole week) - Added a "consume this recipe"-button to the meal plan (and also a button to consume all recipes for a whole week)
- Added a new `config.php` setting `DISABLE_AUTH` to be able to disable authentication / the login screen - Added a new `config.php` setting `DISABLE_AUTH` to be able to disable authentication / the login screen, defaults to `false`
- Added a new `config.php` setting `CALENDAR_FIRST_DAY_OF_WEEK` to be able to change the first day of a week used for calendar views (meal plan for example) in the frontend, defaults to locale default

View File

@@ -21,6 +21,11 @@ Setting('MODE', 'production');
# one of the other available localization files in the "/localization" directory # one of the other available localization files in the "/localization" directory
Setting('CULTURE', 'en'); Setting('CULTURE', 'en');
# This is used to define the first day of a week for calendar views in the frontend,
# leave empty to use the locale default
# Needs to be a number where Sunday = 0, Monday = 1 and so forth
Setting('CALENDAR_FIRST_DAY_OF_WEEK', '');
# To keep it simple: grocy does not handle any currency conversions, # To keep it simple: grocy does not handle any currency conversions,
# this here is used to format all money values, # this here is used to format all money values,
# so doesn't matter really matter, but should be the # so doesn't matter really matter, but should be the

View File

@@ -1,4 +1,10 @@
$("#calendar").fullCalendar({ var firstDay = null;
if (!Grocy.CalendarFirstDayOfWeek.isEmpty())
{
firstDay = parseInt(Grocy.CalendarFirstDayOfWeek);
}
$("#calendar").fullCalendar({
"themeSystem": "bootstrap4", "themeSystem": "bootstrap4",
"header": { "header": {
"left": "month,basicWeek,listWeek", "left": "month,basicWeek,listWeek",
@@ -6,6 +12,7 @@
"right": "prev,next" "right": "prev,next"
}, },
"weekNumbers": true, "weekNumbers": true,
"firstDay": firstDay,
"eventLimit": true, "eventLimit": true,
"eventSources": fullcalendarEventSources "eventSources": fullcalendarEventSources
}); });

View File

@@ -1,5 +1,11 @@
var firstRender = true; var firstRender = true;
var firstDay = null;
if (!Grocy.CalendarFirstDayOfWeek.isEmpty())
{
firstDay = parseInt(Grocy.CalendarFirstDayOfWeek);
}
var calendar = $("#calendar").fullCalendar({ var calendar = $("#calendar").fullCalendar({
"themeSystem": "bootstrap4", "themeSystem": "bootstrap4",
"header": { "header": {
@@ -11,6 +17,7 @@ var calendar = $("#calendar").fullCalendar({
"eventLimit": true, "eventLimit": true,
"eventSources": fullcalendarEventSources, "eventSources": fullcalendarEventSources,
"defaultView": "basicWeek", "defaultView": "basicWeek",
"firstDay": firstDay,
"viewRender": function(view) "viewRender": function(view)
{ {
if (firstRender) if (firstRender)

View File

@@ -52,6 +52,7 @@
Grocy.ActiveNav = '@yield('activeNav', '')'; Grocy.ActiveNav = '@yield('activeNav', '')';
Grocy.Culture = '{{ GROCY_CULTURE }}'; Grocy.Culture = '{{ GROCY_CULTURE }}';
Grocy.Currency = '{{ GROCY_CURRENCY }}'; Grocy.Currency = '{{ GROCY_CURRENCY }}';
Grocy.CalendarFirstDayOfWeek = '{{ GROCY_CALENDAR_FIRST_DAY_OF_WEEK }}';
Grocy.GettextPo = {!! $GettextPo !!}; Grocy.GettextPo = {!! $GettextPo !!};
Grocy.UserSettings = {!! json_encode($userSettings) !!}; Grocy.UserSettings = {!! json_encode($userSettings) !!};
Grocy.FeatureFlags = {!! json_encode($featureFlags) !!}; Grocy.FeatureFlags = {!! json_encode($featureFlags) !!};