Mercurial > libervia-templates
annotate default/blog/item.html @ 91:cc36a5b990ab
input(xmlui): better handling of missing values
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 12 Jan 2018 19:52:37 +0100 |
parents | f19e9f5e43b0 |
children | 94b5806b9e2f |
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 |
49
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
17 <article id="{{item.id}}" class="init box{{other_lang}}{{" clicked" if expanded}}"> |
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 %} |
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
|
21 <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
|
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 |
44
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
24 {# we put a reduce button at the top #} |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
25 <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
|
26 <p> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
27 <span class='hide'>{% trans %}Click to reduce…{% endtrans %}</span> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
28 </p> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
29 </div> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
30 |
0 | 31 <header> |
32 {% block header %} | |
33 <div class="title">{% block blog_title %}{{ item.title_xhtml or item.title or '' }}{% endblock %}</div> | |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
34 {% block metadata %} |
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
35 <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
|
36 {% 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
|
37 <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
|
38 {% else %} |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
39 <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
|
40 {% endif %} |
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
41 <span class="blog_data">{{item.published|date_fmt(fmt=dates_format)}}</span> |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
42 </div> |
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
43 |
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
44 {% endblock metadata %} |
0 | 45 {% endblock header %} |
46 </header> | |
47 | |
34
5fd910d48192
blog/item: "text" class is added for non XHTML content
Goffi <goffi@goffi.org>
parents:
32
diff
changeset
|
48 <div class="content{{' text' if not item.content_xhtml}}"> |
0 | 49 {% block content %} |
49
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
44
diff
changeset
|
50 {{- item.content_xhtml or item.content or '' -}} |
0 | 51 {% endblock content %} |
52 </div> | |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
53 |
44
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
54 {# and the bottom button to expand/reduce the article #} |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
55 <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
|
56 <p> |
44
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
57 <span class='show'>{% trans %}Click to expand…{% endtrans %}</span> |
580670430fa2
blog/item: expand/reduce improvments:
Goffi <goffi@goffi.org>
parents:
42
diff
changeset
|
58 <span class='hide'>{% trans %}Click to reduce…{% endtrans %}</span> |
16
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
59 </p> |
8cdcbe0d7dee
blog: various appareance improvments:
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
60 </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
|
61 |
0 | 62 </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
|
63 |
0 | 64 {% endblock item %} |