diff --git a/resources/sql/queries.sql b/resources/sql/queries.sql index 64ba0d8..ab090ed 100644 --- a/resources/sql/queries.sql +++ b/resources/sql/queries.sql @@ -22,6 +22,18 @@ LIMIT :count OFFSET :offset -- :name get-image-count :? :1 SELECT COUNT(id) as count FROM images +-- :name get-next-image :? :1 +SELECT * FROM images +WHERE created_at > :image-date +ORDER BY created_at ASC +LIMIT 1 + +-- :name get-prev-image :? :1 +SELECT * FROM images +WHERE created_at < :image-date +ORDER BY created_at DESC +LIMIT 1 + -- :name create-tag! :i! INSERT OR IGNORE INTO tags (tagname) diff --git a/resources/templates/detail.html b/resources/templates/detail.html new file mode 100644 index 0000000..44776dc --- /dev/null +++ b/resources/templates/detail.html @@ -0,0 +1,20 @@ +{% extends "layout.html" %} + +{% block content %} + +{% if next-image %} +Weiter +{% endif %} + +{% if prev-image %} +Zurück +{% endif %} + +

{{ image.title }}

+{{ image.title }} + +{% if image.description|length > 0 %} +

{{ image.description }}

+{% endif %} + +{% endblock %} diff --git a/resources/templates/index.html b/resources/templates/index.html index e280528..57649d6 100644 --- a/resources/templates/index.html +++ b/resources/templates/index.html @@ -1,6 +1,14 @@ {% extends "layout.html" %} {% block content %} +
+ {% for image in images %} + + {{ image.title }} + + {% endfor %} +
+
{% if pages|count > 1 %}