comparison default/blog/item.html @ 96:94b5806b9e2f

blog/item: various improvments: - title and publication date are now clickable if HTTP link of item is set - show labels (aka tags/categories) - text only content in body is urlized
author Goffi <goffi@goffi.org>
date Fri, 19 Jan 2018 18:19:57 +0100
parents f19e9f5e43b0
children 609c66552ba0
comparison
equal deleted inserted replaced
95:e4ffb56efd4e 96:94b5806b9e2f
28 </p> 28 </p>
29 </div> 29 </div>
30 30
31 <header> 31 <header>
32 {% block header %} 32 {% block header %}
33 <div class="title">{% block blog_title %}{{ item.title_xhtml or item.title or '' }}{% endblock %}</div> 33 {# title and publication date link to a HTTP page if items_http_uri is set #}
34 {% block metadata %} 34 {% set item_http_uri = items_http_uri.get(item.id) if items_http_uri is defined else none %}
35
36 <div class="title">
37 {% block blog_title scoped %}
38 {% set title = item.title_xhtml or item.title or '' %}
39 {% if item_http_uri %}
40 <a href="{{item_http_uri}}">{{title}}</a>
41 {% else %}
42 {{title}}
43 {% endif %}
44 {% endblock %}
45 </div>
46 {% block metadata scoped %}
35 <div class="metadata"> 47 <div class="metadata">
36 {% if identities is defined %} 48 {% if identities is defined %}
37 <span class="author">{{identities[item.author_jid].nick | default(item.author)}}</span> 49 <span class="author">{{identities[item.author_jid].nick | default(item.author)}}</span>
38 {% else %} 50 {% else %}
39 <span class="author">{{item.author}}</span> 51 <span class="author">{{item.author}}</span>
40 {% endif %} 52 {% endif %}
41 <span class="blog_data">{{item.published|date_fmt(fmt=dates_format)}}</span> 53 {% set published = item.published|date_fmt(fmt=dates_format) %}
54 {% if item_http_uri %}
55 <span class="blog_data"><a href="{{item_http_uri}}">{{published}}</a></span>
56 {% else %}
57 {{- published -}}
58 {% endif %}
42 </div> 59 </div>
43 60 {% if item.tags %}
61 <div class="labels">
62 {% for tag in item.tags %}
63 <span>{{tag}}</span>
64 {% endfor %}
65 </div>
66 {% endif %}
44 {% endblock metadata %} 67 {% endblock metadata %}
45 {% endblock header %} 68 {% endblock header %}
46 </header> 69 </header>
47 70
48 <div class="content{{' text' if not item.content_xhtml}}"> 71 <div class="content{{' text' if not item.content_xhtml}}">
49 {% block content %} 72 {% block content %}
50 {{- item.content_xhtml or item.content or '' -}} 73 {{- item.content_xhtml or item.content|urlize or '' -}}
51 {% endblock content %} 74 {% endblock content %}
52 </div> 75 </div>
53 76
54 {# and the bottom button to expand/reduce the article #} 77 {# and the bottom button to expand/reduce the article #}
55 <div class="expand_box box_bottom" onclick="clicked_mh_fix('{{item.id}}')"> 78 <div class="expand_box box_bottom" onclick="clicked_mh_fix('{{item.id}}')">