summary refs log tree commit diff stats
path: root/lib/Crater/Routes/Gallery.rakumod
blob: 04c8d74eac489ed4b1e5002c1fe63665e8bdb3e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use Cro::HTTP::Router;
use Cro::WebApp::Template;

use Crater::Gallery;
use Crater::Session;

sub gallery-routes(
    Crater::Gallery :$gallery!, #= gallery object
) is export {
    route {
        get -> LoggedIn $session {
            template 'gallery.crotmp', {
                gallery => $gallery.list(),
                title => "Gallery"
            };
        }

        get -> {
            redirect '/login', :see-other;
        }
        get -> *@path {
            static $gallery.directory, @path;
        }
    }
}