Open abandholm opened 11 years ago
This plugin is poor compatibility with "Mojolicious::Routes", so I doesn't consider to provide "taghelper".
I added the "dir_template" option in develop/0.08 branch. What do you think?
# Mojolicious::Lite
plugin Directory => { dir_template => 'index' };
...
__DATA__
@@ index.html.ep
% layout 'default';
% title 'DirectoryIndex';
<h1>Index of <%= $current %></h1>
<ul>
% for my $file (@$files) {
<li><a href='<%= $file->{url} %>'><%== $file->{name} %></a></li>
% }
@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
<head><title><%= title %></title></head>
<body><%= content %></body>
</html>
I suppose you intended it to be a standalone server for static files, but I think it could be even more useful if it could be used in my own templates - something like:
I can almost achieve this by playing with the
handler
anddir_page
, but not easily ;-)