| 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 %} |
| 3 | {% set single = blog_items['items']|length == 1 %} |
| 4 | {% set dates_format='relative' if single else 'short' %} |
| 5 | {% import 'components/avatar.html' as avatar with context %} |
| 6 | {% import 'blog/macros.html' as blog with context %} |
| 7 | {% import 'input/navigation.html' as navigation with context %} |
| 8 | {% import 'input/textbox.html' as textbox with context %} |
| 9 | |
| 10 | {%- block title scoped -%} |
| 11 | {%- if blog_page -%} |
| 12 | {%- if single -%} |
| 13 | {{- blog_items['items'][0].title|default(blog_items['items'][0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} |
| 14 | {%- else -%} |
| 15 | {{C.APP_NAME}} |
| 16 | {# {{- super() -}} |
| 17 | FIXME: super() is failing if blog is embedded (i.e. base/base.html is not its direct parent) |
| 18 | not sure what's the best way to avoid that, so just using C.APP_NAME for now #} |
| 19 | {%- endif -%} |
| 20 | {%- endif -%} |
| 21 | {%- endblock title -%} |
| 22 | |
| 23 | {% block body %} |
| 24 | |
| 25 | {% if blog_items['items'] %} |
| 26 | <div class="container mt-4"> |
| 27 | <nav class="level mb-4"> |
| 28 | <div class="level-left"> |
| 29 | </div> |
| 30 | <div class="level-right"> |
| 31 | <div class="level-item"> |
| 32 | {{ textbox.search() }} |
| 33 | </div> |
| 34 | </div> |
| 35 | </nav> |
| 36 | <div id="blog_items" class="columns"> |
| 37 | <div class="column"> |
| 38 | {{ blog.show_items(blog_items['items'], expanded=single) }} |
| 39 | </div> |
| 40 | </div> |
| 41 | </div> |
| 42 | {% else %} |
| 43 | <div class="message mt-4"> |
| 44 | <div class="message-body"> |
| 45 | {% trans %}No articles found in this blog!{% endtrans %} |
| 46 | </div> |
| 47 | </div> |
| 48 | {% endif %} |
| 49 | |
| 50 | {{ navigation.prev_next(_("older articles"), _("newer articles")) }} |
| 51 | {% endblock body %} |