diff --git a/changelog/56_UNRELEASED_2020-xx-xx.md b/changelog/56_UNRELEASED_2020-xx-xx.md index 8148566e..d54c3aba 100644 --- a/changelog/56_UNRELEASED_2020-xx-xx.md +++ b/changelog/56_UNRELEASED_2020-xx-xx.md @@ -4,6 +4,7 @@ ### Shopping list improvements/fixes - Added an option to hide the month-calendar (in the shopping list settings / top right corner settings menu) (defaults to disabled, so please enable this option if you still want to have the month-calendar on the shopping list) - Optimized the new compact view (there was a little too much white space at the sides of the page) +- Added an option to not switch to the new compact view on mobile devices automatically (in the shopping list settings / top right corner settings menu) (defaults to `false`, so no changed behavior when not configured) (thanks @Forceu) - Fixed that the "Shopping list to stock workflow" did not work when `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING` was set to `false` ### Recipe improvements/fixes diff --git a/config-dist.php b/config-dist.php index 494d790b..85793b05 100644 --- a/config-dist.php +++ b/config-dist.php @@ -97,7 +97,7 @@ DefaultUserSetting('scan_mode_purchase_enabled', false); # Shopping list settings DefaultUserSetting('shopping_list_to_stock_workflow_auto_submit_when_prefilled', false); // Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default best before days" set DefaultUserSetting('shopping_list_show_calendar', false); -DefaultUserSetting('shopping_list_disable_auto_compact_view', false); +DefaultUserSetting('shopping_list_disable_auto_compact_view_on_mobile', false); # Chores settings DefaultUserSetting('chores_due_soon_days', 5); diff --git a/localization/strings.pot b/localization/strings.pot index 04f116c0..88ee0ff2 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -1717,3 +1717,6 @@ msgstr "" msgid "Show a month-view calendar" msgstr "" + +msgid "Don't automatically switch to the compact view on mobile devices" +msgstr "" diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index acac4f2e..dbcb9ada 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -383,8 +383,8 @@ if (window.location.hash === "#compact") $("#shopping-list-compact-view-button").click(); } -// Auto switch to compact view on mobile -if ($(window).width() < 768 & window.location.hash !== "#compact" && !BoolVal(Grocy.UserSettings.shopping_list_disable_auto_compact_view)) +// Auto switch to compact view on mobile when enabled +if ($(window).width() < 768 & window.location.hash !== "#compact" && !BoolVal(Grocy.UserSettings.shopping_list_disable_auto_compact_view_on_mobile)) { $("#shopping-list-compact-view-button").click(); } diff --git a/public/viewjs/shoppinglistsettings.js b/public/viewjs/shoppinglistsettings.js index 68460c61..9872f696 100644 --- a/public/viewjs/shoppinglistsettings.js +++ b/public/viewjs/shoppinglistsettings.js @@ -7,3 +7,8 @@ if (BoolVal(Grocy.UserSettings.shopping_list_show_calendar)) { $("#shopping-list-show-calendar").prop("checked", true); } + +if (BoolVal(Grocy.UserSettings.shopping_list_disable_auto_compact_view_on_mobile)) +{ + $("#shopping-list-disable-auto-compact-view-on-mobile").prop("checked", true); +} diff --git a/views/shoppinglistsettings.blade.php b/views/shoppinglistsettings.blade.php index a0cff48c..0fd74846 100644 --- a/views/shoppinglistsettings.blade.php +++ b/views/shoppinglistsettings.blade.php @@ -17,6 +17,13 @@ +