Mercurial > libervia-templates
annotate sat_templates/templates/default/blog/macros.html @ 164:e9f0a4215e46
multi-sites handling (moved templates to "templates" sub-directory) + noscript styles handling.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 10 Sep 2018 08:53:33 +0200 |
parents | sat_templates/default/blog/macros.html@33c7ce833d3f |
children | 178f55b825b7 |
rev | line source |
---|---|
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
92
diff
changeset
|
1 {% import 'input/textbox.html' as textbox with context %} |
49
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 %} |
92
2963996373fa
blog (macros): fixed "show comments" button
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
21 <button class="comments_btn" onclick="clicked_mh_fix('{{'comments_panel'|next_gidx}}');clicked_cls(this)"> |
49
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> |
92
2963996373fa
blog (macros): fixed "show comments" button
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
26 <div id="{{'comments_panel'|cur_gidx}}" class="comments_panel"> |
49
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"> |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
92
diff
changeset
|
29 {{- textbox.comment(service=comments_items.service, node=comments_items.node) -}} |
49
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 %} |