summary refs log tree commit diff stats
path: root/lib/Crater/Routes/Gallery.rakumod
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Crater/Routes/Gallery.rakumod')
-rw-r--r--lib/Crater/Routes/Gallery.rakumod14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Crater/Routes/Gallery.rakumod b/lib/Crater/Routes/Gallery.rakumod
index 655e62e..ede5010 100644
--- a/lib/Crater/Routes/Gallery.rakumod
+++ b/lib/Crater/Routes/Gallery.rakumod
@@ -18,9 +18,21 @@ sub gallery-routes(
 
         # Gallery view.
         get -> LoggedIn $session, *@path {
+            # Generates a navigation bar for nested directories.
+            my @nav = %(name => "home", url => "/"), ;
+            for @path.kv -> $idx, $p {
+                next if $p eq "";
+                push @nav, %(
+                    name => $p,
+                    url => (@nav[*-1]<url> ~ $p ~ "/")
+                );
+            }
+
             template 'gallery.crotmp', {
                 gallery => $gallery.list(sub-dir => @path),
-                title => "Gallery"
+                title => $gallery.title(),
+                nav => @nav,
+                show-nav => @path.elems ?? True !! False
             };
         }