comparison default/blog/articles.html @ 49:f19e9f5e43b0

blog: moved items rendering to a macro + handle new date filter + handle identities
author Goffi <goffi@goffi.org>
date Fri, 27 Oct 2017 18:50:19 +0200
parents f8798d691acf
children 650f3456f80d
comparison
equal deleted inserted replaced
48:37fd11d71233 49:f19e9f5e43b0
1 {% if not embedded %}{% extends 'base/base.html' %}{% endif %} 1 {% if not embedded %}{% extends 'base/base.html' %}{% endif %}
2 {% import 'input/comment.html' as comment with context %} 2 {% set dates_format='relative' %}
3 3 {% import 'blog/macros.html' as blog with context %}
4 {% macro show_items(items, comments=False) %}
5 {# show items and comments items if present after each item,
6 then post form if allow_commenting is set #}
7 {% for item in items %}
8 {% if not comments %}<div class="main_article">{% endif %}
9 {% include 'blog/item.html' %}
10 {% if not comments %}</div>{% endif %}
11
12 {# we recursively display comments for all comments nodes (usually there's only one) #}
13 {% for comments_items in item.comments_items_list %}
14 <button class="comments_btn" onclick="clicked_mh_fix('{{comments_panel|next_gidx}}');clicked_cls(this)">
15 <span class='show'>{% trans %}show comments{% endtrans %}</span>
16 <span class='hide'>{% trans %}hide comments{% endtrans %}</span>
17 ({{comments_items|count}})
18 </button>
19 <div id="{{comments_panel|cur_gidx}}" class="comments_panel">
20 {% if allow_commenting %}
21 <div class="comment_post">
22 {{ comment.comment(service=comments_items.service, node=comments_items.node) }}
23 </div>
24 {% endif %}
25
26 <div class="comments">
27 {{show_items(comments_items, comments=True)}}
28 </div>
29 </div>
30
31 {% endfor %}
32
33 {% endfor %}
34 {% endmacro %}
35 4
36 {% block body %} 5 {% block body %}
37 <div id="blog_items"> 6 <div id="blog_items">
38 {{ show_items(items) }} 7 {{ blog.show_items(items) }}
39 </div> 8 </div>
40 {% endblock body %} 9 {% endblock body %}