Current section

Files

Jump to
plug_static_ls lib templates plug_static_ls_direntry.html.eex
Raw

lib/templates/plug_static_ls_direntry.html.eex

<%
info_type = file_info(info, :type)
typestr = case info_type do
:directory -> "[Dir]"
:regular -> "[File]"
:symlink -> "[Link]"
_ -> "[Unknown]"
end
dispmod = case info_type do
:directory -> "/"
_ -> ""
end
size = case info_type do
:regular -> to_string(file_info(info, :size))
_ -> ""
end
querystring = case query do
:none -> ""
other -> "?sort=" <> to_string(other)
end
uripath = URI.encode(Path.join(basepath, path)) <> querystring
disppath = Plug.HTML.html_escape(path)
%><tr><td id="filetype"><%= typestr %></td>
<td><a href="<%= uripath %>"><%= disppath %><%= dispmod %></a></td>
<td><%= mtime_to_string(file_info(info, :mtime)) %></td>
<td id="filesize"><%= size %></td>
</tr>