Debian Codegraph @

sat_templates/templates/default/blog/item.html

raw symbols SCIP
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 {% if item.language and locale and locale.language != item.language %}
13 {# we may display items in different language in a specific way #}
14 {% set other_lang = " other_lang" if expanded else " other_lang state_init" %}
15 {% endif %}
16
17 <article id="{{item.id}}" class="box {{"box--comment" if comment else "box--large"}} {{"" if (expanded or comment) else "box--expand"}}{{other_lang}}" >
18
19 {# following message is displayed if item lang is different from page locale #}
20 {% if other_lang is defined %}
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>
22 {% endif %}
23
24 <header>
25 {% block header %}
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
29 <div class="blog__title">
30 {% block blog_title scoped %}
31 {% set title = item.title_xhtml|safe or item.title or '' %}
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 %}
40 <div class="blog__metadata">
41 {% if identities is defined %}
42 {% if avatar is defined %}
43 {{ avatar.avatar(item.author_jid, "avatar--float-left") }}
44 {% endif %}
45 <span class="blog__author">{{identities[item.author_jid].nicknames[0] if identities[item.author_jid].nicknames else item.author}}</span>
46 {% else %}
47 <span class="blog__author">{{item.author}}</span>
48 {% endif %}
49 {% set published = item.published|date_fmt(fmt=dates_format) %}
50 {% if item_http_uri %}
51 <span class="blog__date"><a href="{{item_http_uri}}">{{published}}</a></span>
52 {% else %}
53 {{- published -}}
54 {% endif %}
55 </div>
56 {% if item.tags %}
57 <div class="labels">
58 {% if tags_http_uri is defined %}
59 {% for tag in item.tags %}
60 <a href="{{tags_http_uri[tag]}}"><span>{{tag}}</span></a>
61 {% endfor %}
62 {% else %}
63 {% for tag in item.tags %}
64 <span>{{tag}}</span>
65 {% endfor %}
66 {% endif %}
67 </div>
68 {% endif %}
69 {% endblock metadata %}
70 {% endblock header %}
71 </header>
72
73 <div class="box__content{{' box__content--plaintext' if not item.content_xhtml}}">
74 {% block content %}
75 {{- item.content_xhtml|safe or item.content|urlize or '' -}}
76 {% endblock content %}
77 </div>
78
79 </article>
80
81 {% endblock item %}