annotate default/blog/macros.html @ 61:f76ec90e0e1e

base: menus handling, first draft: this is a very basic way to handle menu (big buttons on the top), just a first draft to be able to navigate.
author Goffi <goffi@goffi.org>
date Sat, 11 Nov 2017 00:16:35 +0100
parents f19e9f5e43b0
children 2963996373fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
1 {% import 'input/comment.html' as comment with context %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
2
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
3 {% macro show_items(items, comments=False, expanded=false, dates_fmt=none) %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
4 {# show items and comments items if present after each item,
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
5 then post form if allow_commenting is set
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
6 @param items(BlogItems): items to show
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
7 @param comments(bool): True items are comments
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
8 if False, a div with "main_article" class will be added
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
9 @param expanded(bool): initial state of items
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
10 #}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
11 {% if dates_format is undefined %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
12 {% set dates_format = dates_fmt or 'short' %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
13 {% endif %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
14 {% for item in items %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
15 {% if not comments %}<div class="main_article">{% endif %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
16 {% include 'blog/item.html' %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
17 {% if not comments %}</div>{% endif %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
18
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
19 {# we recursively display comments for all comments nodes (usually there's only one) #}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
20 {% for comments_items in item.comments_items_list %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
21 <button class="comments_btn" onclick="clicked_mh_fix('{{comments_panel|next_gidx}}');clicked_cls(this)">
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
22 <span class='show'>{% trans %}show comments{% endtrans %}</span>
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
23 <span class='hide'>{% trans %}hide comments{% endtrans %}</span>
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
24 ({{comments_items|count}})
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
25 </button>
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
26 <div id="{{comments_panel|cur_gidx}}" class="comments_panel">
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
27 {% if allow_commenting %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
28 <div class="comment_post">
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
29 {{- comment.comment(service=comments_items.service, node=comments_items.node) -}}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
30 </div>
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
31 {% endif %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
32
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
33 <div class="comments">
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
34 {{show_items(comments_items, comments=True)}}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
35 </div>
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
36 </div>
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
37
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
38 {% endfor %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
39
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
40 {% endfor %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
41 {% endmacro %}