Mercurial > libervia-templates
annotate sat_templates/templates/bulma/blog/item.html @ 296:fbea1b9a558f
bulma: new search box, used in blog for now
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 10 Dec 2020 11:29:04 +0100 |
parents | ce2fd7a3911d |
children | e982a05d43b1 |
rev | line source |
---|---|
230 | 1 {# display a blog item which can be expanded/retracted by clicking on it |
2 | |
3 if the locale differs from item language, it will be totally reduced, and will need a click to be displayed | |
4 | |
5 @variable item(data_object.BlogItem): item to display | |
6 @variable identities(data_object.Identities): identities which can be used to display info on item author | |
7 @variable dates_format(unicode): format of the date to use (see date_fmt filter) | |
8 #} | |
9 | |
10 {% block item %} | |
11 | |
12 {% set item_level = (item_level or 0) + 1 %} | |
13 | |
14 {% if item.language and locale and locale.language != item.language %} | |
15 {# we may display items in different language in a specific way #} | |
16 {% set other_lang = " other_lang" if expanded else " other_lang state_init" %} | |
17 {% endif %} | |
251 | 18 <article id="{{item.id}}" class="media has-background-white px-4 py-3" > |
230 | 19 {% if identities is defined %} |
20 {% if avatar is defined %} | |
21 <div class="media-left"> | |
22 {{ avatar.avatar(item.author_jid) }} | |
23 </div> | |
24 {% endif %} | |
25 {% endif %} | |
26 <div class="media-content"> | |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
246
diff
changeset
|
27 {% set title = item.title_xhtml|safe or item.title%} |
265
ae365c036a58
bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
28 {% set item_http_uri = items_http_uri.get(item.id) if items_http_uri is defined else none %} |
230 | 29 {% if title %} |
265
ae365c036a58
bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
30 <h4 class="title is-4"> |
ae365c036a58
bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
31 {% if item_http_uri %} |
ae365c036a58
bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
32 <a href="{{item_http_uri}}" class="has-text-black">{{title}}</a> |
ae365c036a58
bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
33 {% else %} |
ae365c036a58
bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
34 {{title}} |
ae365c036a58
bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
35 {% endif %} |
ae365c036a58
bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
36 </h4> |
230 | 37 {% endif %} |
38 <div class="content"> | |
39 <p class="subtitle is-6 has-text-grey"> | |
40 {% set published = item.published|date_fmt(fmt=dates_format) %} | |
268
ce2fd7a3911d
bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents:
265
diff
changeset
|
41 {% if Identities is defined %} |
ce2fd7a3911d
bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents:
265
diff
changeset
|
42 <strong>{{identities[item.author_jid].nicknames[0] if identities[item.author_jid].nicknames else item.author}}</strong> |
ce2fd7a3911d
bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents:
265
diff
changeset
|
43 {% else %} |
ce2fd7a3911d
bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents:
265
diff
changeset
|
44 <strong>{{item.author}}</strong> |
ce2fd7a3911d
bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents:
265
diff
changeset
|
45 {% endif %} |
ce2fd7a3911d
bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents:
265
diff
changeset
|
46 <small>{{published}}</small> |
230 | 47 {% if item.tags %} |
48 <small class="labels"> | |
49 {% if tags_http_uri is defined %} | |
50 {% for tag in item.tags %} | |
51 <a href="{{tags_http_uri[tag]}}"><span class="tag is-rounded">{{tag}}</span></a> | |
52 {% endfor %} | |
53 {% else %} | |
54 {% for tag in item.tags %} | |
55 <span class="tag">{{tag}}</span> | |
56 {% endfor %} | |
57 {% endif %} | |
58 </small> | |
59 {% endif %} | |
60 </p> | |
61 <p> | |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
246
diff
changeset
|
62 {{- item.content_xhtml|safe if item.content_xhtml is defined else item.content|urlize -}} |
230 | 63 </p> |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
246
diff
changeset
|
64 {% for comments_data in item.comments %} |
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
246
diff
changeset
|
65 {% for item in comments_data['items'] %} |
230 | 66 {% include 'blog/item.html' %} |
67 {% endfor %} | |
68 {% if allow_commenting and item_level == 1 %} | |
69 <div class="comment_post"> | |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
246
diff
changeset
|
70 {{- textbox.comment(service=comments_data.service, node=comments_data.node) -}} |
230 | 71 </div> |
72 {% endif %} | |
73 {% endfor %} | |
74 | |
75 </div> | |
76 </div> | |
77 </article> | |
78 | |
79 {% endblock item %} |