Mercurial > libervia-templates
changeset 8:7353e5c54359
blog/articles: comments are now displayed if chained, and allow_commenting activate commenting form
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 17 Apr 2017 20:46:11 +0200 |
parents | f1c773126f23 |
children | 7a1626e78d53 |
files | default/blog/articles.html |
diffstat | 1 files changed, 21 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/default/blog/articles.html Mon Apr 17 20:45:09 2017 +0200 +++ b/default/blog/articles.html Mon Apr 17 20:46:11 2017 +0200 @@ -1,9 +1,27 @@ {% extends 'base/base.html' %} +{% import 'input/comments.html' as comments %} + + +{% macro show_items(items) %} + {# show items and comments items if present after each item, + then post form if allow_commenting is set #} + {% for item in items %} + {% include 'blog/item.html' %} + {% for comments_items in item.comments_items_list %} + {% if allow_commenting %} + <div id="comment_post"> + {{ comments.comment(service=comments_items.service, node=comments_items.node) }} + </div> + {% endif %} + <div class="comments"> + {{show_items(comments_items)}} + </div> + {% endfor %} + {% endfor %} +{% endmacro %} {% block body %} <div id="blog_items"> - {% for item in items %} - {% include 'blog/item.html' %} - {% endfor %} + {{ show_items(items) }} </div> {% endblock body %}