aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2023-01-15 02:16:35 +0100
committerJulian Hurst <ark@mansus.space>2023-01-15 02:16:35 +0100
commit09a34dda989df0f74bbfcd11ac63254d61b92a18 (patch)
treea62769481ceea1cd235b60c930a50e7a7c5a49e0 /templates
parent7d502441a6bd210aff8a8625ee87ea5a1fbbd7ee (diff)
downloaddocspace-09a34dda989df0f74bbfcd11ac63254d61b92a18.tar.gz
Add images support (inf scroll via htmx of images taken from user docs)
This commit also includes a migration from css to scss, some improvements to the redirection workflow when no session is found and refactors concerning flash cookies.
Diffstat (limited to 'templates')
-rw-r--r--templates/base.html1
-rw-r--r--templates/imgs.html6
-rw-r--r--templates/imgs_page.html17
-rw-r--r--templates/imgs_stub.html1
-rw-r--r--templates/login.html4
-rw-r--r--templates/nav_logged.html3
-rw-r--r--templates/user.html2
7 files changed, 30 insertions, 4 deletions
diff --git a/templates/base.html b/templates/base.html
index c2ca497..653570d 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,6 +1,7 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="icon" href="data:;base64,iVBORw0KGgo=">
<link rel="stylesheet" type="text/css" href="/static/style.css">
<script src="/static/htmx.min.js"></script>
<title>{{block "title" .}}{{end}} - docspace</title>
diff --git a/templates/imgs.html b/templates/imgs.html
new file mode 100644
index 0000000..9b584a8
--- /dev/null
+++ b/templates/imgs.html
@@ -0,0 +1,6 @@
+{{define "title"}}Acceuil{{end}}
+{{define "content"}}
+ <h1>Images</h1>
+ {{template "imgspage" .}}
+ <span>{{.NbFiles}} images</span>
+{{end}}
diff --git a/templates/imgs_page.html b/templates/imgs_page.html
new file mode 100644
index 0000000..665daf3
--- /dev/null
+++ b/templates/imgs_page.html
@@ -0,0 +1,17 @@
+{{define "imgspage"}}
+{{range $i, $img := .Imgs}}
+ {{if eq (add $i $.Start) $.End}}
+ <div hx-get="/imgs?page={{add $.Page 1}}&fragment"
+ hx-trigger="revealed"
+ hx-swap="afterend">
+ <span>{{$img.Name}}</span><br/>
+ <a href="{{$img.Link}}"><img src="{{$img.Link}}" /></a><br/>
+ {{else}}
+ <div>
+ <span>{{$img.Name}}</span><br/>
+ <a href="{{$img.Link}}"><img src="{{$img.Link}}" /></a><br/>
+ {{end}}
+ <hr/>
+ </div>
+{{end}}
+{{end}}
diff --git a/templates/imgs_stub.html b/templates/imgs_stub.html
new file mode 100644
index 0000000..a1c542b
--- /dev/null
+++ b/templates/imgs_stub.html
@@ -0,0 +1 @@
+{{template "imgspage" .}}
diff --git a/templates/login.html b/templates/login.html
index e1b4c44..5e717c3 100644
--- a/templates/login.html
+++ b/templates/login.html
@@ -5,8 +5,8 @@
<p class="error">{{.Error}}</p>
{{end}}
<form action="/login" method="POST">
- <input type="text" name="user" id="user" placeholder="Nom d'utilisateur"><br/><br/>
- <input type="password" name="pass" id="pass" placeholder="Mot de passe"><br/><br/>
+ <input required type="text" name="user" id="user" placeholder="Nom d'utilisateur"><br/><br/>
+ <input required type="password" name="pass" id="pass" placeholder="Mot de passe"><br/><br/>
<input type="submit" value="Connexion">
</form>
{{end}}
diff --git a/templates/nav_logged.html b/templates/nav_logged.html
index a62585f..50e9a36 100644
--- a/templates/nav_logged.html
+++ b/templates/nav_logged.html
@@ -1,8 +1,9 @@
{{define "nav"}}
<nav>
- <ul class="nav">
+ <ul class="navlogged">
<!--<li><a href="/admin">Admin</a></li>-->
<li><a href="/">Accueil</a></li>
+ <li><a href="/imgs">Images</a></li>
<li><a href="/logout">Se déconnecter</a></li>
</ul>
</nav>
diff --git a/templates/user.html b/templates/user.html
index f116286..cd0d98c 100644
--- a/templates/user.html
+++ b/templates/user.html
@@ -27,7 +27,7 @@
<a href="{{.Link}}">{{.Name}}</a>
</td>
<td>
- {{.ModTime}}
+ {{formatmodtime .ModTime}}
</td>
<td>
{{.Size}}