summary refs log blame commit diff stats
path: root/lib/Crater/Routes/Gallery.rakumod
blob: cf79cc6d66d212f018640d880247df0d1a9a1319 (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.add(".crater/thumbnails"), @path;
        }
    }
}