Mercurial > libervia-templates
annotate default/blog/item.html @ 133:0a0d9a953d98
css: some more refactoring
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 26 Mar 2018 08:13:53 +0200 |
parents | 988a1c0e8419 |
children |
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 #} |
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
|
14 {% set other_lang = " other_lang" %} |
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 |
112
988a1c0e8419
blog/item: fixed "expanded" parameter
Goffi <goffi@goffi.org>
parents:
99
diff
changeset
|
17 {% if expanded %} |
988a1c0e8419
blog/item: fixed "expanded" parameter
Goffi <goffi@goffi.org>
parents:
99
diff
changeset
|
18 {# FIXME: the style attribute is not nice, but due to the use of clicked_mh_fix. A cleaner way would be welcomed #} |
988a1c0e8419
blog/item: fixed "expanded" parameter
Goffi <goffi@goffi.org>
parents:
99
diff
changeset
|
19 <article id="{{item.id}}" class="init box{{other_lang}} clicked" style="max-height: none"> |
988a1c0e8419
blog/item: fixed "expanded" parameter
Goffi <goffi@goffi.org>
parents:
99
diff
changeset
|
20 {% else %} |
988a1c0e8419
blog/item: fixed "expanded" parameter
Goffi <goffi@goffi.org>
parents:
99
diff
changeset
|
21 <article id="{{item.id}}" class="init box{{other_lang}}" > |
988a1c0e8419
blog/item: fixed "expanded" parameter
Goffi <goffi@goffi.org>
parents:
99
diff
changeset
|
22 {% endif %} |
44
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
23 |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
24 {# 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
|
25 {% if other_lang is defined %} |
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
|
26 <div class="info"><p>{% trans language=locale.language_name %}This message is not in {{language}}, click to display anyway{% endtrans %}</p></div> |
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
|
27 {% 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
|
28 |
44
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
29 {# we put a reduce button at the top #} |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
30 <div class="expand_box box_top" onclick="clicked_mh_fix('{{item.id}}')"> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
31 <p> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
32 <span class='hide'>{% trans %}Click to reduce…{% endtrans %}</span> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
33 </p> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
34 </div> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
35 |
0 | 36 <header> |
37 {% block header %} | |
96 | 38 {# title and publication date link to a HTTP page if items_http_uri is set #} |
39 {% set item_http_uri = items_http_uri.get(item.id) if items_http_uri is defined else none %} | |
40 | |
41 <div class="title"> | |
42 {% block blog_title scoped %} | |
43 {% set title = item.title_xhtml or item.title or '' %} | |
44 {% if item_http_uri %} | |
45 <a href="{{item_http_uri}}">{{title}}</a> | |
46 {% else %} | |
47 {{title}} | |
48 {% endif %} | |
49 {% endblock %} | |
50 </div> | |
51 {% block metadata scoped %} | |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
52 <div class="metadata"> |
49
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
53 {% if identities is defined %} |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
54 <span class="author">{{identities[item.author_jid].nick | default(item.author)}}</span> |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
55 {% else %} |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
56 <span class="author">{{item.author}}</span> |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
57 {% endif %} |
96 | 58 {% set published = item.published|date_fmt(fmt=dates_format) %} |
59 {% if item_http_uri %} | |
60 <span class="blog_data"><a href="{{item_http_uri}}">{{published}}</a></span> | |
61 {% else %} | |
62 {{- published -}} | |
63 {% endif %} | |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
64 </div> |
96 | 65 {% if item.tags %} |
66 <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
|
67 {% 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
|
68 {% 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
|
69 <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
|
70 {% endfor %} |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
71 {% else %} |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
72 {% 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
|
73 <span>{{tag}}</span> |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
74 {% endfor %} |
609c66552ba0
blog/item: handle new tags_http_uri variable to make tags clickable
Goffi <goffi@goffi.org>
parents:
96
diff
changeset
|
75 {% endif %} |
96 | 76 </div> |
77 {% endif %} | |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
78 {% endblock metadata %} |
0 | 79 {% endblock header %} |
80 </header> | |
81 | |
34
5fd910d48192
blog/item: "text" class is added for non XHTML content
Goffi <goffi@goffi.org>
parents:
32
diff
changeset
|
82 <div class="content{{' text' if not item.content_xhtml}}"> |
0 | 83 {% block content %} |
96 | 84 {{- item.content_xhtml or item.content|urlize or '' -}} |
0 | 85 {% endblock content %} |
86 </div> | |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
87 |
44
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
88 {# and the bottom button to expand/reduce the article #} |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
89 <div class="expand_box box_bottom" onclick="clicked_mh_fix('{{item.id}}')"> |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
90 <p> |
44
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
91 <span class='show'>{% trans %}Click to expand…{% endtrans %}</span> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
92 <span class='hide'>{% trans %}Click to reduce…{% endtrans %}</span> |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
93 </p> |
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
94 </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
|
95 |
0 | 96 </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
|
97 |
0 | 98 {% endblock item %} |