Mercurial > libervia-templates
comparison default/blog/item.html @ 49:f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Oct 2017 18:50:19 +0200 |
parents | 580670430fa2 |
children | 94b5806b9e2f |
comparison
equal
deleted
inserted
replaced
48:37fd11d71233 | 49:f19e9f5e43b0 |
---|---|
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 | |
1 {% block item %} | 10 {% block item %} |
2 | 11 |
3 {% if item.language and locale and locale.language != item.language %} | 12 {% if item.language and locale and locale.language != item.language %} |
4 {# we may display items in different language in a specific way #} | 13 {# we may display items in different language in a specific way #} |
5 {% set other_lang = " other_lang" %} | 14 {% set other_lang = " other_lang" %} |
6 {% endif %} | 15 {% endif %} |
7 | 16 |
8 <article id="{{item.id}}" class="init box{{other_lang}}"> | 17 <article id="{{item.id}}" class="init box{{other_lang}}{{" clicked" if expanded}}"> |
9 | 18 |
10 {# following message is displayed if item lang is different from page locale #} | 19 {# following message is displayed if item lang is different from page locale #} |
11 {% if other_lang is defined %} | 20 {% if other_lang is defined %} |
12 <div class="info"><p>{% trans language=locale.language_name %}This message is not in {{language}}, click to display anyway{% endtrans %}</p></div> | 21 <div class="info"><p>{% trans language=locale.language_name %}This message is not in {{language}}, click to display anyway{% endtrans %}</p></div> |
13 {% endif %} | 22 {% endif %} |
22 <header> | 31 <header> |
23 {% block header %} | 32 {% block header %} |
24 <div class="title">{% block blog_title %}{{ item.title_xhtml or item.title or '' }}{% endblock %}</div> | 33 <div class="title">{% block blog_title %}{{ item.title_xhtml or item.title or '' }}{% endblock %}</div> |
25 {% block metadata %} | 34 {% block metadata %} |
26 <div class="metadata"> | 35 <div class="metadata"> |
27 <span class="author">{{identities[item.author_jid].nick | default(item.author)}}</span> | 36 {% if identities is defined %} |
28 <span class="blog_data">{% trans days=item.published|date_days %}{{days}} days ago{% endtrans %}</span> | 37 <span class="author">{{identities[item.author_jid].nick | default(item.author)}}</span> |
38 {% else %} | |
39 <span class="author">{{item.author}}</span> | |
40 {% endif %} | |
41 <span class="blog_data">{{item.published|date_fmt(fmt=dates_format)}}</span> | |
29 </div> | 42 </div> |
30 | 43 |
31 {% endblock metadata %} | 44 {% endblock metadata %} |
32 {% endblock header %} | 45 {% endblock header %} |
33 </header> | 46 </header> |
34 | 47 |
35 <div class="content{{' text' if not item.content_xhtml}}"> | 48 <div class="content{{' text' if not item.content_xhtml}}"> |
36 {% block content %} | 49 {% block content %} |
37 {{ item.content_xhtml or item.content or ''}} | 50 {{- item.content_xhtml or item.content or '' -}} |
38 {% endblock content %} | 51 {% endblock content %} |
39 </div> | 52 </div> |
40 | 53 |
41 {# and the bottom button to expand/reduce the article #} | 54 {# and the bottom button to expand/reduce the article #} |
42 <div class="expand_box box_bottom" onclick="clicked_mh_fix('{{item.id}}')"> | 55 <div class="expand_box box_bottom" onclick="clicked_mh_fix('{{item.id}}')"> |