# HG changeset patch # User Goffi # Date 1594883312 -7200 # Node ID 40fccd3b7cf0cfd9a5d5b4c98c5bd8d7d914c408 # Parent 1928ba66c19476e40f1059a5e666877d89170729 updated code to handle blog items following data structure change in backend/Libervia diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/bulma/blog/articles.html --- a/sat_templates/templates/bulma/blog/articles.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/bulma/blog/articles.html Thu Jul 16 09:08:32 2020 +0200 @@ -1,6 +1,6 @@ {# blog_page indicate if blog is included in an other page or if it is the main one #} {% if not embedded %}{% extends 'base/base.html' %}{% set blog_page = True %}{% endif %} -{% set single = items|length == 1 %} +{% set single = blog_items['items']|length == 1 %} {% set dates_format='relative' if single else 'short' %} {% import 'components/avatar.html' as avatar with context %} {% import 'blog/macros.html' as blog with context %} @@ -9,7 +9,7 @@ {%- block title scoped -%} {%- if blog_page -%} {%- if single -%} - {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} + {{- blog_items['items'][0].title|default(blog_items['items'][0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} {%- else -%} {{C.APP_NAME}} {# {{- super() -}} @@ -20,11 +20,12 @@ {%- endblock title -%} {% block body %} -{% if items %} + +{% if blog_items['items'] %}
- {{ blog.show_items(items, expanded=single) }} + {{ blog.show_items(blog_items['items'], expanded=single) }}
diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/bulma/blog/item.html --- a/sat_templates/templates/bulma/blog/item.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/bulma/blog/item.html Thu Jul 16 09:08:32 2020 +0200 @@ -24,7 +24,7 @@ {% endif %} {% endif %}
- {% set title = item.title_xhtml or item.title%} + {% set title = item.title_xhtml|safe or item.title%} {% if title %}

{{title}}

{% endif %} @@ -47,15 +47,15 @@ {% endif %}

- {{- item.content_xhtml or item.content|urlize or '' -}} + {{- item.content_xhtml|safe if item.content_xhtml is defined else item.content|urlize -}}

- {% for comments_items in item.comments_items_list %} - {% for item in comments_items %} + {% for comments_data in item.comments %} + {% for item in comments_data['items'] %} {% include 'blog/item.html' %} {% endfor %} {% if allow_commenting and item_level == 1 %}
- {{- textbox.comment(service=comments_items.service, node=comments_items.node) -}} + {{- textbox.comment(service=comments_data.service, node=comments_data.node) -}}
{% endif %} {% endfor %} diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/bulma/event/admin.html --- a/sat_templates/templates/bulma/event/admin.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/bulma/event/admin.html Thu Jul 16 09:08:32 2020 +0200 @@ -106,7 +106,7 @@
- {% if items is defined %} + {% if blog_items is defined %} {% include 'blog/articles.html' %} {% endif %}
diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/bulma/forum/view.html --- a/sat_templates/templates/bulma/forum/view.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/bulma/forum/view.html Thu Jul 16 09:08:32 2020 +0200 @@ -9,7 +9,7 @@
- {{ blog.show_items(items, expanded=true) }} + {{ blog.show_items(blog_items["items"], expanded=true) }}
diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/bulma/merge-request/item.html --- a/sat_templates/templates/bulma/merge-request/item.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/bulma/merge-request/item.html Thu Jul 16 09:08:32 2020 +0200 @@ -57,7 +57,7 @@ {% if comments is defined %} - {{ blog.show_items(comments|reverse, expanded=true) }} + {{ blog.show_items(comments['items']|reverse, expanded=true) }} {% endif %} {% if comments_node is defined %}
diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/bulma/photo/item.html --- a/sat_templates/templates/bulma/photo/item.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/bulma/photo/item.html Thu Jul 16 09:08:32 2020 +0200 @@ -29,7 +29,9 @@ 0% {% else %}
- {{ blog.show_items(file.comments, expanded=true, dates_fmt='relative') }} + {% if file.comments %} + {{ blog.show_items(file.comments['items'], expanded=true, dates_fmt='relative') }} + {% endif %}
{{- textbox.comment_or_login(service=file.comments_service, node=file.comments_node) -}}
diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/bulma/ticket/item.html --- a/sat_templates/templates/bulma/ticket/item.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/bulma/ticket/item.html Thu Jul 16 09:08:32 2020 +0200 @@ -40,7 +40,7 @@
{% if comments is defined %} - {{ blog.show_items(comments|reverse, expanded=true) }} + {{ blog.show_items(comments['items']|reverse, expanded=true) }} {% endif %} {% if comments_node is defined %}
diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/default/blog/articles.html --- a/sat_templates/templates/default/blog/articles.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/default/blog/articles.html Thu Jul 16 09:08:32 2020 +0200 @@ -1,6 +1,6 @@ {# blog_page indicate if blog is included in an other page or if it is the main one #} {% if not embedded %}{% extends 'base/base.html' %}{% set blog_page = True %}{% endif %} -{% set single = items|length == 1 %} +{% set single = blog_items['items']|length == 1 %} {% set dates_format='relative' if single else 'short' %} {% import 'components/avatar.html' as avatar with context %} {% import 'blog/macros.html' as blog with context %} @@ -9,7 +9,7 @@ {%- block title scoped -%} {%- if blog_page -%} {%- if single -%} - {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} + {{- blog_items['items'][0].title|default(blog_items['items'][0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} {%- else -%} {{C.APP_NAME}} {# {{- super() -}} @@ -21,9 +21,9 @@ {% block body %} {{ icon_defs('angle-double-left', 'angle-double-right') }} -{% if items %} +{% if blog_items['items'] %}
- {{ blog.show_items(items, expanded=single) }} + {{ blog.show_items(blog_items['items'], expanded=single) }}
{% else %}

{% trans %}No articles found in this blog!{% endtrans %}

diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/default/blog/item.html --- a/sat_templates/templates/default/blog/item.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/default/blog/item.html Thu Jul 16 09:08:32 2020 +0200 @@ -28,7 +28,7 @@
{% block blog_title scoped %} - {% set title = item.title_xhtml or item.title or '' %} + {% set title = item.title_xhtml|safe or item.title or '' %} {% if item_http_uri %} {{title}} {% else %} @@ -42,7 +42,7 @@ {% if avatar is defined %} {{ avatar.avatar(item.author_jid, "avatar--float-left") }} {% endif %} - {{identities[item.author_jid].nicknames[0] if identities[item.author_jid].nicknames else item.author}} + {{identities[item.author_jid].nicknames[0] if identities[item.author_jid].nicknames else item.author)}} {% else %} {{item.author}} {% endif %} @@ -72,7 +72,7 @@
{% block content %} - {{- item.content_xhtml or item.content|urlize or '' -}} + {{- item.content_xhtml|safe or item.content|urlize or '' -}} {% endblock content %}
diff -r 1928ba66c194 -r 40fccd3b7cf0 sat_templates/templates/default/event/admin.html --- a/sat_templates/templates/default/event/admin.html Fri Jun 19 17:57:13 2020 +0200 +++ b/sat_templates/templates/default/event/admin.html Thu Jul 16 09:08:32 2020 +0200 @@ -90,7 +90,7 @@
- {% if items is defined %} + {% if blog_items is defined %} {% include 'blog/articles.html' %} {% endif %}