annotate sat_templates/default/blog/articles.html @ 152:da2c0dc7c1ff

blog/articles: work around for titles
author Goffi <goffi@goffi.org>
date Thu, 21 Jun 2018 01:02:33 +0200
parents 33c7ce833d3f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
8b5615a1bf3d articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents: 8
diff changeset
1 {% if not embedded %}{% extends 'base/base.html' %}{% endif %}
114
1d0ddeb79903 blog/article: set "single" variable when a single article is shown, and expand items in this case
Goffi <goffi@goffi.org>
parents: 113
diff changeset
2 {% set single = items|length == 1 %}
113
e96a3e09d4e9 blog/articles: use short dates when severals items are shown because the page is cached, and relative for single view.
Goffi <goffi@goffi.org>
parents: 111
diff changeset
3 {% set dates_format='relative' if single else 'short' %}
49
f19e9f5e43b0 blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents: 43
diff changeset
4 {% import 'blog/macros.html' as blog with context %}
115
5d9e2270ceb4 blog/articles, input/navigation: moved navigation template in a dedicated macro
Goffi <goffi@goffi.org>
parents: 114
diff changeset
5 {% import 'input/navigation.html' as navigation with context %}
0
9a31d2c02f47 SàT templates, initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
6
152
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
7 {%- block title scoped -%}
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
8 {%- if not embedded -%}
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
9 {%- if single -%}
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
10 {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}}
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
11 {%- else -%}
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
12 {{C.APP_NAME}}
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
13 {# {{- super() -}}
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
14 FIXME: super() is failing if blog is embedded (i.e. base/base.html is not its direct parent)
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
15 not sure what's the best way to avoid that, so just using C.APP_NAME for now #}
da2c0dc7c1ff blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents: 147
diff changeset
16 {%- endif -%}
95
e4ffb56efd4e blog/articles: if only one item is shown, use it's title or content as page title.
Goffi <goffi@goffi.org>
parents: 93
diff changeset
17 {%- endif -%}
102
7108731be0b9 blog/articles: don't set content in title block if embedded, to avoid exception with missing parent title
Goffi <goffi@goffi.org>
parents: 95
diff changeset
18 {%- endblock title -%}
95
e4ffb56efd4e blog/articles: if only one item is shown, use it's title or content as page title.
Goffi <goffi@goffi.org>
parents: 93
diff changeset
19
0
9a31d2c02f47 SàT templates, initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
20 {% block body %}
132
c70f405f9b86 blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents: 115
diff changeset
21 {% if items %}
c70f405f9b86 blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents: 115
diff changeset
22 <div id="blog_items">
c70f405f9b86 blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents: 115
diff changeset
23 {{ blog.show_items(items, expanded=single) }}
c70f405f9b86 blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents: 115
diff changeset
24 </div>
c70f405f9b86 blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents: 115
diff changeset
25 {% else %}
c70f405f9b86 blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents: 115
diff changeset
26 <p class="message--info">{% trans %}No articles found in this blog!{% endtrans %}</p>
c70f405f9b86 blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents: 115
diff changeset
27 {% endif %}
115
5d9e2270ceb4 blog/articles, input/navigation: moved navigation template in a dedicated macro
Goffi <goffi@goffi.org>
parents: 114
diff changeset
28
5d9e2270ceb4 blog/articles, input/navigation: moved navigation template in a dedicated macro
Goffi <goffi@goffi.org>
parents: 114
diff changeset
29 {{ navigation.prev_next(_("newer articles"), _("older articles")) }}
0
9a31d2c02f47 SàT templates, initial commit
Goffi <goffi@goffi.org>
parents:
diff changeset
30 {% endblock body %}