Added a feature flag to also be able to hide all stock related UI elements and routes (closes #228)

This commit is contained in:
Bernd Bestel
2019-05-03 20:03:04 +02:00
parent bd296f8fe1
commit 4c2cf4944d
5 changed files with 61 additions and 27 deletions

View File

@@ -28,7 +28,7 @@ class SystemController extends BaseController
$demoDataGeneratorService->PopulateDemoData();
}
return $response->withRedirect($this->AppContainer->UrlManager->ConstructUrl('/stockoverview'));
return $response->withRedirect($this->AppContainer->UrlManager->ConstructUrl($this->GetEntryPageRelative()));
}
public function About(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
@@ -38,4 +38,24 @@ class SystemController extends BaseController
'changelog' => $this->ApplicationService->GetChangelog()
]);
}
private function GetEntryPageRelative()
{
$entryPage = '/stockoverview';
if (!GROCY_FEATURE_FLAG_STOCK)
{
$entryPage = '/choresoverview';
}
if (!GROCY_FEATURE_FLAG_CHORES)
{
$entryPage = '/batteriesoverview';
}
if (!GROCY_FEATURE_FLAG_BATTERIES)
{
$entryPage = '/equipment';
}
return $entryPage;
}
}