summary refs log blame commit diff stats
path: root/lib/Crater/Routes/Gallery.rakumod
blob: 04c8d74eac489ed4b1e5002c1fe63665e8bdb3e1 (plain) (tree)
























                                                 
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;
        }
    }
}