Mercurial > libervia-templates
annotate sat_templates/templates/default/blog/item.html @ 270:2378084522e1
bulma (dialogs): new `macros.html` with a search dialog
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 14 Aug 2020 08:46:00 +0200 |
parents | 40fccd3b7cf0 |
children | c5de5514a251 |
rev | line source |
---|---|
49
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
1 {# display a blog item which can be expanded/retracted by clicking on it |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
2 |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
3 if the locale differs from item language, it will be totally reduced, and will need a click to be displayed |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
4 |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
5 @variable item(data_object.BlogItem): item to display |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
6 @variable identities(data_object.Identities): identities which can be used to display info on item author |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
7 @variable dates_format(unicode): format of the date to use (see date_fmt filter) |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
8 #} |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
9 |
0 | 10 {% block item %} |
30
69a2e3bf5e17
blog/item: if item is not in same language as current locale, item is hidden but will be shown on click.
Goffi <goffi@goffi.org>
parents:
24
diff
changeset
|
11 |
36
baa0942d6b45
blog/item: fixed other_lang detection
Goffi <goffi@goffi.org>
parents:
34
diff
changeset
|
12 {% if item.language and locale and locale.language != item.language %} |
30
69a2e3bf5e17
blog/item: if item is not in same language as current locale, item is hidden but will be shown on click.
Goffi <goffi@goffi.org>
parents:
24
diff
changeset
|
13 {# we may display items in different language in a specific way #} |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
14 {% set other_lang = " other_lang" if expanded else " other_lang state_init" %} |
30
69a2e3bf5e17
blog/item: if item is not in same language as current locale, item is hidden but will be shown on click.
Goffi <goffi@goffi.org>
parents:
24
diff
changeset
|
15 {% endif %} |
69a2e3bf5e17
blog/item: if item is not in same language as current locale, item is hidden but will be shown on click.
Goffi <goffi@goffi.org>
parents:
24
diff
changeset
|
16 |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
17 <article id="{{item.id}}" class="box {{"box--comment" if comment else "box--large"}} {{"" if (expanded or comment) else "box--expand"}}{{other_lang}}" > |
44
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
18 |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
19 {# following message is displayed if item lang is different from page locale #} |
30
69a2e3bf5e17
blog/item: if item is not in same language as current locale, item is hidden but will be shown on click.
Goffi <goffi@goffi.org>
parents:
24
diff
changeset
|
20 {% if other_lang is defined %} |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
21 <div class="info show_if_parent_init"><p>{% trans language=locale.language_name %}This message is not in {{language}}, click to display anyway{% endtrans %}</p></div> |
30
69a2e3bf5e17
blog/item: if item is not in same language as current locale, item is hidden but will be shown on click.
Goffi <goffi@goffi.org>
parents:
24
diff
changeset
|
22 {% endif %} |
69a2e3bf5e17
blog/item: if item is not in same language as current locale, item is hidden but will be shown on click.
Goffi <goffi@goffi.org>
parents:
24
diff
changeset
|
23 |
0 | 24 <header> |
25 {% block header %} | |
96 | 26 {# title and publication date link to a HTTP page if items_http_uri is set #} |
27 {% set item_http_uri = items_http_uri.get(item.id) if items_http_uri is defined else none %} | |
28 | |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
29 <div class="blog__title"> |
96 | 30 {% block blog_title scoped %} |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
231
diff
changeset
|
31 {% set title = item.title_xhtml|safe or item.title or '' %} |
96 | 32 {% if item_http_uri %} |
33 <a href="{{item_http_uri}}">{{title}}</a> | |
34 {% else %} | |
35 {{title}} | |
36 {% endif %} | |
37 {% endblock %} | |
38 </div> | |
39 {% block metadata scoped %} | |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
40 <div class="blog__metadata"> |
49
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
41 {% if identities is defined %} |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
42 {% if avatar is defined %} |
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
43 {{ avatar.avatar(item.author_jid, "avatar--float-left") }} |
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
44 {% endif %} |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
231
diff
changeset
|
45 <span class="blog__author">{{identities[item.author_jid].nicknames[0] if identities[item.author_jid].nicknames else item.author)}}</span> |
49
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
46 {% else %} |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
47 <span class="blog__author">{{item.author}}</span> |
49
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
48 {% endif %} |
96 | 49 {% set published = item.published|date_fmt(fmt=dates_format) %} |
50 {% if item_http_uri %} | |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
51 <span class="blog__date"><a href="{{item_http_uri}}">{{published}}</a></span> |
96 | 52 {% else %} |
53 {{- published -}} | |
54 {% endif %} | |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
55 </div> |
96 | 56 {% if item.tags %} |
57 <div class="labels"> | |
99
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
58 {% if tags_http_uri is defined %} |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
59 {% for tag in item.tags %} |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
60 <a href="{{tags_http_uri[tag]}}"><span>{{tag}}</span></a> |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
61 {% endfor %} |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
62 {% else %} |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
63 {% for tag in item.tags %} |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
64 <span>{{tag}}</span> |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
65 {% endfor %} |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
66 {% endif %} |
96 | 67 </div> |
68 {% endif %} | |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
69 {% endblock metadata %} |
0 | 70 {% endblock header %} |
71 </header> | |
72 | |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
73 <div class="box__content{{' box__content--plaintext' if not item.content_xhtml}}"> |
0 | 74 {% block content %} |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
231
diff
changeset
|
75 {{- item.content_xhtml|safe or item.content|urlize or '' -}} |
0 | 76 {% endblock content %} |
77 </div> | |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
78 |
0 | 79 </article> |
30
69a2e3bf5e17
blog/item: if item is not in same language as current locale, item is hidden but will be shown on click.
Goffi <goffi@goffi.org>
parents:
24
diff
changeset
|
80 |
0 | 81 {% endblock item %} |