Mercurial > libervia-templates
changeset 247:40fccd3b7cf0
updated code to handle blog items following data structure change in backend/Libervia
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 16 Jul 2020 09:08:32 +0200 |
parents | 1928ba66c194 |
children | a841837afe78 |
files | sat_templates/templates/bulma/blog/articles.html sat_templates/templates/bulma/blog/item.html sat_templates/templates/bulma/event/admin.html sat_templates/templates/bulma/forum/view.html sat_templates/templates/bulma/merge-request/item.html sat_templates/templates/bulma/photo/item.html sat_templates/templates/bulma/ticket/item.html sat_templates/templates/default/blog/articles.html sat_templates/templates/default/blog/item.html sat_templates/templates/default/event/admin.html |
diffstat | 10 files changed, 25 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- 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'] %} <div class="container mt-4"> <div id="blog_items" class="columns"> <div class="column"> - {{ blog.show_items(items, expanded=single) }} + {{ blog.show_items(blog_items['items'], expanded=single) }} </div> </div> </div>
--- 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 %} <div class="media-content"> - {% set title = item.title_xhtml or item.title%} + {% set title = item.title_xhtml|safe or item.title%} {% if title %} <h4 class="title is-4">{{title}}</h1> {% endif %} @@ -47,15 +47,15 @@ {% endif %} </p> <p> - {{- item.content_xhtml or item.content|urlize or '' -}} + {{- item.content_xhtml|safe if item.content_xhtml is defined else item.content|urlize -}} </p> - {% 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 %} <div class="comment_post"> - {{- textbox.comment(service=comments_items.service, node=comments_items.node) -}} + {{- textbox.comment(service=comments_data.service, node=comments_data.node) -}} </div> {% endif %} {% endfor %}
--- 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 @@ </div> <div class="tab__page" id="tab_blog"> - {% if items is defined %} + {% if blog_items is defined %} {% include 'blog/articles.html' %} {% endif %} </div>
--- 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 @@ <section class="section"> - {{ blog.show_items(items, expanded=true) }} + {{ blog.show_items(blog_items["items"], expanded=true) }} </section> <section class="section">
--- 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 @@ </div> {% 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 %} <div class="comment_post">
--- 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 @@ <progress class="progress is-info mt-4 has-background-white" value="0" max="100">0%</progress> {% else %} <div id='{{'comments_panel'|cur_gidx}}' class="mt-4 panel-drawer"> - {{ 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 %} <div class="comment_post mt-4"> {{- textbox.comment_or_login(service=file.comments_service, node=file.comments_node) -}} </div>
--- 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 @@ </div> {% 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 %} <div class="comment_post">
--- 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'] %} <div id="blog_items"> - {{ blog.show_items(items, expanded=single) }} + {{ blog.show_items(blog_items['items'], expanded=single) }} </div> {% else %} <p class="message--info">{% trans %}No articles found in this blog!{% endtrans %}</p>
--- 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 @@ <div class="blog__title"> {% 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 %} <a href="{{item_http_uri}}">{{title}}</a> {% else %} @@ -42,7 +42,7 @@ {% if avatar is defined %} {{ avatar.avatar(item.author_jid, "avatar--float-left") }} {% endif %} - <span class="blog__author">{{identities[item.author_jid].nicknames[0] if identities[item.author_jid].nicknames else item.author}}</span> + <span class="blog__author">{{identities[item.author_jid].nicknames[0] if identities[item.author_jid].nicknames else item.author)}}</span> {% else %} <span class="blog__author">{{item.author}}</span> {% endif %} @@ -72,7 +72,7 @@ <div class="box__content{{' box__content--plaintext' if not item.content_xhtml}}"> {% block content %} - {{- item.content_xhtml or item.content|urlize or '' -}} + {{- item.content_xhtml|safe or item.content|urlize or '' -}} {% endblock content %} </div>
--- 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 @@ </div> <div class="tab__page" id="tab_blog"> - {% if items is defined %} + {% if blog_items is defined %} {% include 'blog/articles.html' %} {% endif %} </div>