From 86f5667039e741462125334a409da128a6e2b5b5 Mon Sep 17 00:00:00 2001 From: Niels Tholenaar Date: Sat, 22 Jun 2019 16:02:52 +0200 Subject: [PATCH] Allow possibility to choose custom homepage --- config-dist.php | 5 +++-- controllers/SystemController.php | 33 +++++++++++++++++--------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/config-dist.php b/config-dist.php index 2b3f2c4b..72afae5a 100644 --- a/config-dist.php +++ b/config-dist.php @@ -41,8 +41,9 @@ Setting('STOCK_BARCODE_LOOKUP_PLUGIN', 'DemoBarcodeLookupPlugin'); # set this to true Setting('DISABLE_URL_REWRITING', false); - - +# By default the homepage will be set to the stock overview. +# You can set this to any overview you want. Example: Use recipes to set the homepage to the recipes overview. +Setting('ENTRY_PAGE', 'stock'); # Default user settings # These settings can be changed per user, here the defaults diff --git a/controllers/SystemController.php b/controllers/SystemController.php index b9a8d998..cbff1bc6 100644 --- a/controllers/SystemController.php +++ b/controllers/SystemController.php @@ -41,21 +41,24 @@ class SystemController extends BaseController private function GetEntryPageRelative() { - $entryPage = '/stockoverview'; - - if (!GROCY_FEATURE_FLAG_STOCK) - { - $entryPage = '/choresoverview'; + switch (GROCY_ENTRY_PAGE) { + default: + case 'stock': + return '/stockoverview'; + case 'shoppinglist': + return '/shoppinglist'; + case 'recipes': + return '/recipes'; + case 'chores': + return '/choresoverview'; + case 'tasks': + return '/tasks'; + case 'batteries': + return '/batteriesoverview'; + case 'equipment': + return '/equipment'; + case 'calendar': + return '/calendar'; } - if (!GROCY_FEATURE_FLAG_CHORES) - { - $entryPage = '/batteriesoverview'; - } - if (!GROCY_FEATURE_FLAG_BATTERIES) - { - $entryPage = '/equipment'; - } - - return $entryPage; } }