diff --git a/app/Controllers/DirectoryController.php b/app/Controllers/DirectoryController.php index 9b9b37a..d9b4440 100644 --- a/app/Controllers/DirectoryController.php +++ b/app/Controllers/DirectoryController.php @@ -42,6 +42,7 @@ class DirectoryController return $this->view->render($response, 'index.twig', [ 'breadcrumbs' => $this->breadcrumbs($path), 'files' => $files->in($path), + 'is_root' => $this->isRoot($path), ]); } @@ -64,4 +65,16 @@ class DirectoryController return $carry; }, []); } + + /** + * Undocumented function. + * + * @param string $path + * + * @return bool + */ + protected function isRoot(string $path): bool + { + return realpath($path) === realpath($this->config->get('app.root')); + } } diff --git a/app/themes/default/index.twig b/app/themes/default/index.twig index 1d0612e..0e93123 100644 --- a/app/themes/default/index.twig +++ b/app/themes/default/index.twig @@ -33,6 +33,29 @@ + {% if not is_root %} + +
+ +
+ +
+ .. +
+ + + + +
+ {% endif %} + {% for file in files %} set(Twig::class, function (Config $config) { }); /** Configure the application components */ +$container->call(function (Config $config) { + $config->set('app.root', __DIR__); +}); $container->call(FilesComposer::class); $container->call(ViewComposer::class);