annotate sat_templates/templates/default/blog/macros.html @ 354:cac1a96f3df8

bulma (static): better padding on inline `code`
author Goffi <goffi@goffi.org>
date Fri, 25 Nov 2022 17:07:26 +0100
parents 178f55b825b7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
166
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
3 {% macro show_items(items, comment=False, expanded=false, dates_fmt=none) %}
49
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
166
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
7 @param comment(bool): True items are comments
49
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 %}
166
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
15 {% if not comment %}<div class="main_article">{% endif %}
49
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' %}
166
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
17 {% if not comment %}</div>{% endif %}
49
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 %}
166
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
21 <div class="box box__under box--large">
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
22 <button class="btn-fold" onclick="clicked_mh_fix('{{'comments_panel'|next_gidx}}');clicked_cls(this)">
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
23 <span class='show_if_parent_not_clicked'>{% trans %}show comments{% endtrans %}</span>
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
24 <span class='show_if_parent_clicked'>{% trans %}hide comments{% endtrans %}</span>
49
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
25 ({{comments_items|count}})
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
26 </button>
166
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
27 </div>
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
28 <div id="{{'comments_panel'|cur_gidx}}" class="panel-drawer">
49
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
29 {% if allow_commenting %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
30 <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
31 {{- 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
32 </div>
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
33 {% endif %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
34
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
35 <div class="comments">
166
178f55b825b7 small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents: 164
diff changeset
36 {{show_items(comments_items, comment=True)}}
49
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
37 </div>
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
38 </div>
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
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
42 {% endfor %}
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
diff changeset
43 {% endmacro %}