aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-19 21:01:49 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-19 21:02:35 +0200
commitb8b6d3037c524575f140650ac243c16df6a98a92 (patch)
treebf9dfb99481389b6714041bc36fd8f23a1db332b /templates
parentfbcac585cf626917e2baf1d0065c7b632341ba01 (diff)
downloadlens-b8b6d3037c524575f140650ac243c16df6a98a92.tar.gz
lens-b8b6d3037c524575f140650ac243c16df6a98a92.tar.bz2
lens-b8b6d3037c524575f140650ac243c16df6a98a92.zip
feat: Move last page to qtpl
Diffstat (limited to 'templates')
-rw-r--r--templates/base.qtpl6
-rw-r--r--templates/fs.html29
-rw-r--r--templates/fs.qtpl41
-rw-r--r--templates/layout.html29
4 files changed, 44 insertions, 61 deletions
diff --git a/templates/base.qtpl b/templates/base.qtpl
index cbde355..0c05782 100644
--- a/templates/base.qtpl
+++ b/templates/base.qtpl
@@ -22,13 +22,13 @@ Page prints a page implementing Page interface.
<body>
<nav class="navbar">
<div class="navbar-start">
- <a href="/fs" class="navbar-item">
+ <a href="/fs/" class="navbar-item">
files
</a>
- <a href="/media" class="navbar-item">
+ <a href="/media/" class="navbar-item">
media
</a>
- <a href="/settings" class="navbar-item">
+ <a href="/settings/" class="navbar-item">
settings
</a>
</div>
diff --git a/templates/fs.html b/templates/fs.html
deleted file mode 100644
index a44d78f..0000000
--- a/templates/fs.html
+++ /dev/null
@@ -1,29 +0,0 @@
-{{template "layout.html" .}}
-{{define "title"}} {{.Title}} {{end}}
-{{define "content"}}
-<div class="panel">
- <div class="panel-block">
- <div class="columns file-row is-gapless is-mobile">
- <div id="path" class="container-fluid">
- <small>{{range .Data.Page.History}}<a href="/fs?path={{.UrlEncodedPath}}" >{{.Name}}/</a>{{end}}</small>
- </div>
- </div>
- </div>
- {{range .Data.Page.Files}}
- <div class="panel-block">
- <div class="columns wide-column is-mono is-gapless is-mobile">
- <div class="column">
- {{if $.Data.ShowMode}}{{.Info.Mode}}&emsp;{{end}}
- {{if $.Data.ShowOwner}}{{.Info.Sys.Gid}}:{{.Info.Sys.Uid}}&emsp;{{end}}
- {{if .Info.IsDir}}
- <a href="/?path={{.UrlEncodedPath}}">{{.Info.Name}}/</a>
- {{else}}
- {{.Info.Name}}
- {{end}}
- </div>
- <div class="column has-text-right">{{.Info.Size}} B</div>
- </div>
- </div>
- {{end}}
-</div>
-{{end}}
diff --git a/templates/fs.qtpl b/templates/fs.qtpl
new file mode 100644
index 0000000..489f79f
--- /dev/null
+++ b/templates/fs.qtpl
@@ -0,0 +1,41 @@
+{% import "git.sr.ht/~gabrielgio/img/pkg/service" %}
+
+{% code
+type FilePage struct {
+ Page *service.Page
+ ShowMode bool
+ ShowOwner bool
+ }%}
+
+{% func (p *FilePage) Title() %}Files{% endfunc %}
+
+{% func (p *FilePage) Content() %}
+<div class="panel">
+ <div class="panel-block">
+ <div class="columns file-row is-gapless is-mobile">
+ <div id="path" class="container-fluid">
+ <small>{% for _, h := range p.Page.History %}<a href="/fs?path={%s h.UrlEncodedPath %}" >{%s h.Name %}/</a>{% endfor %}</small>
+ </div>
+ </div>
+ </div>
+ {% for _, f := range p.Page.Files %}
+ <div class="panel-block">
+ <div class="columns wide-column is-mono is-gapless is-mobile">
+ <div class="column">
+ {% if p.ShowMode %}{%s f.Info.Mode().String() %}&emsp;{% endif %}
+ {% if p.ShowOwner %}{%d f.GetGid() %}:{%d f.GetUid() %}&emsp;{% endif %}
+ {% if f.Info.IsDir() %}
+ <a href="/?path={%s f.UrlEncodedPath %}">{%s f.Info.Name() %}/</a>
+ {% else %}
+ {%s f.Info.Name() %}
+ {% endif %}
+ </div>
+ <div class="column has-text-right">{%dl f.Info.Size() %} B</div>
+ </div>
+ </div>
+ {% endfor %}
+</div>
+{% endfunc %}
+
+{% func (p *FilePage) Script() %}
+{% endfunc %}
diff --git a/templates/layout.html b/templates/layout.html
deleted file mode 100644
index bbf1558..0000000
--- a/templates/layout.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>img | {{block "title" .}} noop {{end}}</title>
- <link rel="stylesheet" href="/static/main.css">
- <link rel="icon" href="/static/square.svg" sizes="any" type="image/svg+xml">
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- </head>
- <body>
- <nav class="navbar">
- <div class="navbar-start">
- <a href="/fs" class="navbar-item">
- files
- </a>
- <a href="/media" class="navbar-item">
- media
- </a>
- <a href="/settings" class="navbar-item">
- settings
- </a>
- </div>
- </nav>
- <div class="container">
- {{block "content" .}}noop{{end}}
- </div>
- </body>
- {{block "script" .}}{{end}}
-</html>