From 3d4c191376d77ea8b0a8abad05b8f14020aa85f5 Mon Sep 17 00:00:00 2001 From: Felipe Martin Date: Sat, 14 Dec 2019 22:46:57 +0100 Subject: [PATCH] Post gallery support --- models/gallery.ini | 7 +++++++ templates/blog/post.html | 7 +++++-- templates/macros/blog.html | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 models/gallery.ini diff --git a/models/gallery.ini b/models/gallery.ini new file mode 100644 index 0000000..157852c --- /dev/null +++ b/models/gallery.ini @@ -0,0 +1,7 @@ +[model] +name = Gallery +label = gallery +hidden = no + +[pagination] +enabled = no diff --git a/templates/blog/post.html b/templates/blog/post.html index d572adf..0cebdeb 100644 --- a/templates/blog/post.html +++ b/templates/blog/post.html @@ -1,5 +1,5 @@ {% extends "blog/_base.html" %} -{% from "macros/blog.html" import render_blog_post %} +{% from "macros/blog.html" import render_blog_post, render_gallery %} {% block body_class %}blog post{% endblock %} @@ -7,8 +7,11 @@ {% block main_content %} {{ render_blog_post(this) }} + {% if this.children.get("gallery") %} + {{ render_gallery(this) }} + {% endif %}
- Comments have been disabled in this blog, if you want to contact me directly please go ahead! + Comments have been disabled in this blog. If you want to contact me directly please use the information in the bottom of the page.
{% endblock %} diff --git a/templates/macros/blog.html b/templates/macros/blog.html index aed8f86..5c479cc 100644 --- a/templates/macros/blog.html +++ b/templates/macros/blog.html @@ -20,3 +20,17 @@
{% endmacro %} + +{% macro render_gallery(post) %} +
+

Gallery

+
+ {% for attachment in post.children.get("gallery").attachments.order_by("_id") %} + + + + {% endfor %} +
+
+
+{% endmacro %}