aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-09-12 18:37:30 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-09-12 18:40:00 +0200
commitae10e121875982d6956d6bff453544cc59a75616 (patch)
tree9b6508c9b2a105ce3027bb24342916050e2f50cc /templates
parentd33ba9ee675eedf47ce4a7977d116bf81dda5b2e (diff)
downloadlens-ae10e121875982d6956d6bff453544cc59a75616.tar.gz
lens-ae10e121875982d6956d6bff453544cc59a75616.tar.bz2
lens-ae10e121875982d6956d6bff453544cc59a75616.zip
feat: Add admin control
Now only admins can access settings.
Diffstat (limited to 'templates')
-rw-r--r--templates/album.qtpl4
-rw-r--r--templates/base.qtpl12
-rw-r--r--templates/media.qtpl2
-rw-r--r--templates/mosaic.qtpl6
-rw-r--r--templates/settings.qtpl2
-rw-r--r--templates/user.qtpl4
6 files changed, 16 insertions, 14 deletions
diff --git a/templates/album.qtpl b/templates/album.qtpl
index 835db57..58fc499 100644
--- a/templates/album.qtpl
+++ b/templates/album.qtpl
@@ -23,14 +23,14 @@ func (m *AlbumPage) PreloadAttr() string {
<h1 class="title text-size-1">{%s p.Name %}</h1>
<div class="tags are-large">
{% for _, a := range p.Albums %}
- <a href="/album/?albumId={%s FromUInttoString(&a.ID) %}" class="tag text-size-2">{%s a.Name %}</a>
+ <a href="/album?albumId={%s FromUInttoString(&a.ID) %}" class="tag text-size-2">{%s a.Name %}</a>
{% endfor %}
</div>
<div class="columns">
{%= Mosaic(p.Medias, p.PreloadAttr()) %}
</div>
<div>
- <a href="/album/?albumId={%s FromUInttoString(p.Next.AlbumID) %}&page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
+ <a href="/album?albumId={%s FromUInttoString(p.Next.AlbumID) %}&page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
</div>
{% endfunc %}
diff --git a/templates/base.qtpl b/templates/base.qtpl
index a80803a..30b084e 100644
--- a/templates/base.qtpl
+++ b/templates/base.qtpl
@@ -21,7 +21,7 @@ Page {
Page prints a page implementing Page interface.
-{% func PageTemplate(p Page) %}
+{% func PageTemplate(p Page, isAdmin bool) %}
<html lang="en">
<head>
<meta charset="utf-8">
@@ -33,18 +33,20 @@ Page prints a page implementing Page interface.
<body>
<nav class="navbar">
<div class="navbar-start">
- <a href="/fs/" class="navbar-item text-size-1">
+ <a href="/fs" class="navbar-item text-size-1">
file
</a>
- <a href="/media/" class="navbar-item text-size-1">
+ <a href="/media" class="navbar-item text-size-1">
media
</a>
- <a href="/album/" class="navbar-item text-size-1">
+ <a href="/album" class="navbar-item text-size-1">
album
</a>
- <a href="/settings/" class="navbar-item text-size-1">
+ {% if isAdmin %}
+ <a href="/settings" class="navbar-item text-size-1">
settings
</a>
+ {% endif %}
</div>
</nav>
<div class="container is-fullhd">
diff --git a/templates/media.qtpl b/templates/media.qtpl
index 4251deb..737d03d 100644
--- a/templates/media.qtpl
+++ b/templates/media.qtpl
@@ -22,7 +22,7 @@ func (m *MediaPage) PreloadAttr() string {
{%= Mosaic(p.Medias, p.PreloadAttr()) %}
</div>
<div>
- <a href="/media/?page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
+ <a href="/media?page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
</div>
{% endfunc %}
diff --git a/templates/mosaic.qtpl b/templates/mosaic.qtpl
index 3e6ccf8..18dbcba 100644
--- a/templates/mosaic.qtpl
+++ b/templates/mosaic.qtpl
@@ -8,12 +8,12 @@
{% for _, media := range c %}
<div class="card-image">
{% if media.IsVideo() %}
- <video class="image is-fit" controls muted="true" poster="/media/thumbnail/?path_hash={%s media.PathHash %}" preload="{%s preloadAttr %}">
- <source src="/media/image/?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
+ <video class="image is-fit" controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="{%s preloadAttr %}">
+ <source src="/media/image?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
</video>
{% else %}
<figure class="image is-fit">
- <img src="/media/thumbnail/?path_hash={%s media.PathHash %}">
+ <img src="/media/thumbnail?path_hash={%s media.PathHash %}">
</figure>
{% endif %}
</div>
diff --git a/templates/settings.qtpl b/templates/settings.qtpl
index 4439c77..b720a88 100644
--- a/templates/settings.qtpl
+++ b/templates/settings.qtpl
@@ -58,7 +58,7 @@ type SettingsPage struct {
</div>
{% endfor %}
<div class="field">
- <a href="/users/" class="button">create</a>
+ <a href="/users" class="button">create</a>
</div>
</div>
{% endfunc %}
diff --git a/templates/user.qtpl b/templates/user.qtpl
index 6ec783d..6fc3ce6 100644
--- a/templates/user.qtpl
+++ b/templates/user.qtpl
@@ -13,7 +13,7 @@ type UserPage struct {
{% func (p *UserPage) Content() %}
<h1>Initial Setup</h1>
-<form action="/users/" method="post">
+<form action="/users" method="post">
{% if p.ID != nil %}
<input type="hidden" name="userId" value="{%s FromUInttoString(p.ID) %}" />
{% endif %}
@@ -41,7 +41,7 @@ type UserPage struct {
<div class="field">
<label class="label">Is Admin?</label>
<div class="control">
- <input type="checkbox" name="isAdmin" type="password" {% if p.IsAdmin %}checked{% endif %}>
+ <input type="checkbox" name="isAdmin" {% if p.IsAdmin %}checked{% endif %}>
</div>
</div>
<div class="field">