| 1 | {% import 'input/textbox.html' as textbox with context %} |
| 2 | |
| 3 | {% macro show_items(items, comment=False, expanded=false, dates_fmt=none) %} |
| 4 | {# show items and comments items if present after each item, |
| 5 | then post form if allow_commenting is set |
| 6 | @param items(BlogItems): items to show |
| 7 | @param comment(bool): True items are comments |
| 8 | if False, a div with "main_article" class will be added |
| 9 | @param expanded(bool): initial state of items |
| 10 | #} |
| 11 | {% if dates_format is undefined %} |
| 12 | {% set dates_format = dates_fmt or 'short' %} |
| 13 | {% endif %} |
| 14 | {% for item in items %} |
| 15 | {% if not comment %}<div class="main_article">{% endif %} |
| 16 | {% include 'blog/item.html' %} |
| 17 | {% if not comment %}</div>{% endif %} |
| 18 | |
| 19 | {# we recursively display comments for all comments nodes (usually there's only one) #} |
| 20 | {% for comments_items in item.comments_items_list %} |
| 21 | <div class="box box__under box--large"> |
| 22 | <button class="btn-fold" onclick="clicked_mh_fix('{{'comments_panel'|next_gidx}}');clicked_cls(this)"> |
| 23 | <span class='show_if_parent_not_clicked'>{% trans %}show comments{% endtrans %}</span> |
| 24 | <span class='show_if_parent_clicked'>{% trans %}hide comments{% endtrans %}</span> |
| 25 | ({{comments_items|count}}) |
| 26 | </button> |
| 27 | </div> |
| 28 | <div id="{{'comments_panel'|cur_gidx}}" class="panel-drawer"> |
| 29 | {% if allow_commenting %} |
| 30 | <div class="comment_post"> |
| 31 | {{- textbox.comment(service=comments_items.service, node=comments_items.node) -}} |
| 32 | </div> |
| 33 | {% endif %} |
| 34 | |
| 35 | <div class="comments"> |
| 36 | {{show_items(comments_items, comment=True)}} |
| 37 | </div> |
| 38 | </div> |
| 39 | |
| 40 | {% endfor %} |
| 41 | |
| 42 | {% endfor %} |
| 43 | {% endmacro %} |