diff --git a/assets/styles/app.css b/assets/styles/app.css index aba4857..eb9da0d 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -1,3 +1,8 @@ body { background-color: transparent; +} + +a:hover { + color: deepskyblue; + text-decoration: underline; } \ No newline at end of file diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 3f795d9..e13e04b 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -1,5 +1,7 @@ twig: file_name_pattern: '*.twig' + globals: + routing_service: '@App\Service\Twig\RoutingService' when@test: twig: diff --git a/src/Service/Twig/RoutingService.php b/src/Service/Twig/RoutingService.php new file mode 100644 index 0000000..fdca911 --- /dev/null +++ b/src/Service/Twig/RoutingService.php @@ -0,0 +1,23 @@ +attributes->get('dirs', ''); + $dirs = explode('/', $dirsString); + array_pop($dirs); + + return $this->urlGenerator->generate('app_home', ['dirs' => implode('/', $dirs)]); + } +} \ No newline at end of file diff --git a/templates/_partials/_row.html.twig b/templates/_partials/_row.html.twig index cf570e4..41567fe 100644 --- a/templates/_partials/_row.html.twig +++ b/templates/_partials/_row.html.twig @@ -1,13 +1,24 @@ +{% if file.name == '..' %} + {% set link = routing_service.goBack(app.request) %} +{% else %} + {% set link = path('app_home', {dirs: app.request.attributes.get('dirs') ~ '/' ~ file.name}) %} +{% endif %} + +