Mercurial > libervia-templates
annotate default/blog/articles.html @ 114:1d0ddeb79903
blog/article: set "single" variable when a single article is shown, and expand items in this case
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 26 Jan 2018 07:52:41 +0100 |
parents | e96a3e09d4e9 |
children | 5d9e2270ceb4 |
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 %} |
0 | 5 |
111
e1a0d5678837
blog/articles: don't use super() in title block for now, it crashes if parent is not base/base.html
Goffi <goffi@goffi.org>
parents:
102
diff
changeset
|
6 {% block title scoped -%} |
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
|
7 {%- if single -%} |
111
e1a0d5678837
blog/articles: don't use super() in title block for now, it crashes if parent is not base/base.html
Goffi <goffi@goffi.org>
parents:
102
diff
changeset
|
8 {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} |
e1a0d5678837
blog/articles: don't use super() in title block for now, it crashes if parent is not base/base.html
Goffi <goffi@goffi.org>
parents:
102
diff
changeset
|
9 {%- else -%} |
e1a0d5678837
blog/articles: don't use super() in title block for now, it crashes if parent is not base/base.html
Goffi <goffi@goffi.org>
parents:
102
diff
changeset
|
10 {{C.APP_NAME}} |
e1a0d5678837
blog/articles: don't use super() in title block for now, it crashes if parent is not base/base.html
Goffi <goffi@goffi.org>
parents:
102
diff
changeset
|
11 {# {{- super() -}} |
e1a0d5678837
blog/articles: don't use super() in title block for now, it crashes if parent is not base/base.html
Goffi <goffi@goffi.org>
parents:
102
diff
changeset
|
12 FIXME: super() is failing if blog is embedded (i.e. base/base.html is not its direct parent) |
e1a0d5678837
blog/articles: don't use super() in title block for now, it crashes if parent is not base/base.html
Goffi <goffi@goffi.org>
parents:
102
diff
changeset
|
13 not sure what's the best way to avoid that, so just using C.APP_NAME for now #} |
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
|
14 {%- 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
|
15 {%- 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
|
16 |
0 | 17 {% block body %} |
18 <div id="blog_items"> | |
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
|
19 {{ blog.show_items(items, expanded=single) }} |
0 | 20 </div> |
93
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
21 <nav class="bottom_links"> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
22 <ul> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
23 {% if newer_url is defined %} |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
24 <li class="newer_items"> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
25 <a href="{{newer_url}}"> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
26 <img src="{{media_path}}icons/tango/actions/32/go-previous.png"> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
27 {% trans %}newer articles{% endtrans %} |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
28 </a> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
29 </li> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
30 {% endif %} |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
31 {% if older_url is defined %} |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
32 <li class="older_items"> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
33 <a href="{{older_url}}"> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
34 <img src="{{media_path}}icons/tango/actions/32/go-next.png"> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
35 {% trans %}older articles{% endtrans %} |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
36 </a> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
37 </li> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
38 {% endif %} |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
39 </ul> |
650f3456f80d
blog/articles: added simple pagination
Goffi <goffi@goffi.org>
parents:
49
diff
changeset
|
40 </nav> |
0 | 41 {% endblock body %} |