From 902cb20710fd071f9a593d468bb256cd689fe992 Mon Sep 17 00:00:00 2001 From: Webysther Sperandio Date: Sun, 5 Feb 2023 15:06:59 +0100 Subject: [PATCH] Add Sub feature flag FEATURE_FLAG_RECIPES_MEALPLAN (#2118) * Update routes.php Added sub feature FEATURE_FLAG_RECIPES_MEALPLAN * Update default.blade.php Added sub feature flag FEATURE_FLAG_RECIPES_MEALPLAN * Update SystemController.php Added Sub feature flags FEATURE_FLAG_RECIPES_MEALPLAN * Update config-dist.php Sub feature flags FEATURE_FLAG_RECIPES_MEALPLAN * Update routes.php TYPO * Code formatting / structure --------- Co-authored-by: Bernd Bestel --- config-dist.php | 1 + controllers/SystemController.php | 2 +- routes.php | 10 +++++++--- views/layout/default.blade.php | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config-dist.php b/config-dist.php index 3545e938..fa3b47dd 100644 --- a/config-dist.php +++ b/config-dist.php @@ -140,6 +140,7 @@ Setting('FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING', true); Setting('FEATURE_FLAG_STOCK_PRODUCT_FREEZING', true); Setting('FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD', true); // Activate the number pad in due date fields on (supported) mobile browsers Setting('FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS', true); +Setting('FEATURE_FLAG_RECIPES_MEALPLAN', true); Setting('FEATURE_FLAG_CHORES_ASSIGNMENTS', true); Setting('FEATURE_FLAG_THERMAL_PRINTER', false); diff --git a/controllers/SystemController.php b/controllers/SystemController.php index 119964cf..4371f632 100644 --- a/controllers/SystemController.php +++ b/controllers/SystemController.php @@ -102,7 +102,7 @@ class SystemController extends BaseController } // Meal Plan - if ($entryPage === 'mealplan' && constant('GROCY_FEATURE_FLAG_RECIPES')) + if ($entryPage === 'mealplan' && constant('GROCY_FEATURE_FLAG_RECIPES_MEALPLAN')) { return '/mealplan'; } diff --git a/routes.php b/routes.php index 7e02f0b0..b0b2710d 100644 --- a/routes.php +++ b/routes.php @@ -87,11 +87,15 @@ $app->group('', function (RouteCollectorProxy $group) { $group->get('/recipes', '\Grocy\Controllers\RecipesController:Overview'); $group->get('/recipe/{recipeId}', '\Grocy\Controllers\RecipesController:RecipeEditForm'); $group->get('/recipe/{recipeId}/pos/{recipePosId}', '\Grocy\Controllers\RecipesController:RecipePosEditForm'); - $group->get('/mealplan', '\Grocy\Controllers\RecipesController:MealPlan'); - $group->get('/mealplansections', '\Grocy\Controllers\RecipesController:MealPlanSectionsList'); - $group->get('/mealplansection/{sectionId}', '\Grocy\Controllers\RecipesController:MealPlanSectionEditForm'); $group->get('/recipessettings', '\Grocy\Controllers\RecipesController:RecipesSettings'); $group->get('/recipe/{recipeId}/grocycode', '\Grocy\Controllers\RecipesController:RecipeGrocycodeImage'); + + if (GROCY_FEATURE_FLAG_RECIPES_MEALPLAN) + { + $group->get('/mealplan', '\Grocy\Controllers\RecipesController:MealPlan'); + $group->get('/mealplansections', '\Grocy\Controllers\RecipesController:MealPlanSectionsList'); + $group->get('/mealplansection/{sectionId}', '\Grocy\Controllers\RecipesController:MealPlanSectionEditForm'); + } } // Chore routes diff --git a/views/layout/default.blade.php b/views/layout/default.blade.php index 8dd87de3..7a3b5c40 100644 --- a/views/layout/default.blade.php +++ b/views/layout/default.blade.php @@ -188,6 +188,7 @@ {{ $__t('Recipes') }} + @if(GROCY_FEATURE_FLAG_RECIPES_MEALPLAN) @endif + @endif @if(GROCY_FEATURE_FLAG_CHORES)