Filesystem

/views/vfile/List.html (862 B)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{% import (
"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/lib/filesystem"
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/components"
) %}

{% func List(path []string, files filesystem.FileInfos, fl filesystem.FileLoader, urlPrefix string, as *app.State, ps *cutil.PageState) %}
<h3><a href="{%s urlPrefix %}">.</a>{%- for idx, p := range path -%}/<a href="{%s urlPrefix %}/{%s util.StringFilePath(path[:idx + 1]...) %}">{%s p %}</a>{%- endfor -%}</h3>
<div class="mt">
{%- for _, f := range files -%}
{%- code
icon := "file"
if f.IsDir {
icon = "folder"
}
u := urlPrefix + f.QueryEscapedPath(path...)
-%}
<div><a href="{%s u %}">{%= components.SVGInline(icon, 16, ps) %}</a> <a href="{%s u %}">{%s f.Name %}</a></div>
{%- endfor -%}
</div>
{% endfunc %}