github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vfile/List.html (about) 1 <!-- Content managed by Project Forge, see [projectforge.md] for details. --> 2 {% import ( 3 "path/filepath" 4 5 "github.com/kyleu/dbaudit/app" 6 "github.com/kyleu/dbaudit/app/controller/cutil" 7 "github.com/kyleu/dbaudit/app/lib/filesystem" 8 "github.com/kyleu/dbaudit/views/components" 9 ) %} 10 11 {% func List(path []string, files filesystem.FileInfos, fl filesystem.FileLoader, urlPrefix string, as *app.State, ps *cutil.PageState) %} 12 <h3><a href="{%s urlPrefix %}">.</a>{%- for idx, p := range path -%}/<a href="{%s urlPrefix %}/{%s filepath.Join(path[:idx + 1]...) %}">{%s p %}</a>{%- endfor -%}</h3> 13 <div class="mt"> 14 {%- for _, f := range files -%} 15 {%- code 16 icon := "file" 17 if f.IsDir { 18 icon = "folder" 19 } 20 x := []string{urlPrefix} 21 x = append(x, path...) 22 x = append(x, f.Name) 23 u := filepath.Join(x...) 24 -%} 25 <div><a href="{%s u %}">{%= components.SVGRef(icon, 16, 16, `icon`, ps) %}{%s f.Name %}</a></div> 26 {%- endfor -%} 27 </div> 28 {% endfunc %}