Mercurial > libervia-templates
annotate sat_templates/templates/default/blog/articles.html @ 295:1de599c5a68f
bulma (base): loading screen:
when the `loading_screen` variable is set before extending `base/base.html`, a loading
modal is shown (and must be removed via JavaScript). This avoids the user to try to use an
interface which is not reactive or working normally because JS is not fully loaded yet.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Nov 2020 12:24:03 +0100 |
parents | 40fccd3b7cf0 |
children |
rev | line source |
---|---|
209 | 1 {# blog_page indicate if blog is included in an other page or if it is the main one #} |
2 {% if not embedded %}{% extends 'base/base.html' %}{% set blog_page = True %}{% endif %} | |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
209
diff
changeset
|
3 {% set single = blog_items['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
|
4 {% set dates_format='relative' if single else 'short' %} |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
5 {% import 'components/avatar.html' as avatar with context %} |
49
f19e9f5e43b0
blog: moved items rendering to a macro + handle new date filter + handle identities
Goffi <goffi@goffi.org>
parents:
43
diff
changeset
|
6 {% 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
|
7 {% import 'input/navigation.html' as navigation with context %} |
0 | 8 |
152
da2c0dc7c1ff
blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
9 {%- block title scoped -%} |
209 | 10 {%- if blog_page -%} |
152
da2c0dc7c1ff
blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
11 {%- if single -%} |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
209
diff
changeset
|
12 {{- blog_items['items'][0].title|default(blog_items['items'][0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} |
152
da2c0dc7c1ff
blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
13 {%- else -%} |
da2c0dc7c1ff
blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
14 {{C.APP_NAME}} |
da2c0dc7c1ff
blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
15 {# {{- super() -}} |
da2c0dc7c1ff
blog/articles: work around for titles
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
16 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
|
17 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
|
18 {%- 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
|
19 {%- 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
|
20 {%- 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
|
21 |
0 | 22 {% block body %} |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
23 {{ icon_defs('angle-double-left', 'angle-double-right') }} |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
209
diff
changeset
|
24 {% if blog_items['items'] %} |
132
c70f405f9b86
blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents:
115
diff
changeset
|
25 <div id="blog_items"> |
247
40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents:
209
diff
changeset
|
26 {{ blog.show_items(blog_items['items'], expanded=single) }} |
132
c70f405f9b86
blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents:
115
diff
changeset
|
27 </div> |
c70f405f9b86
blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents:
115
diff
changeset
|
28 {% else %} |
c70f405f9b86
blog (articles): show a message when no article is found
Goffi <goffi@goffi.org>
parents:
115
diff
changeset
|
29 <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
|
30 {% endif %} |
115
5d9e2270ceb4
blog/articles, input/navigation: moved navigation template in a dedicated macro
Goffi <goffi@goffi.org>
parents:
114
diff
changeset
|
31 |
5d9e2270ceb4
blog/articles, input/navigation: moved navigation template in a dedicated macro
Goffi <goffi@goffi.org>
parents:
114
diff
changeset
|
32 {{ navigation.prev_next(_("newer articles"), _("older articles")) }} |
0 | 33 {% endblock body %} |