annotate sat_templates/templates/bulma/blog/item.html @ 405:5016fb0ff62f default tip

Blog redesign: work in progress redesign of the blog. Some templates have been moved from chat to components to be re-used in other features, like blog here. Blog follows same global design as chat with a left panel to search/open blogs.
author Goffi <goffi@goffi.org>
date Wed, 21 May 2025 15:41:00 +0200
parents ddcdc0475940
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 {# display a blog item which can be expanded/retracted by clicking on it
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
2
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3 if the locale differs from item language, it will be totally reduced, and will need a click to be displayed
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
4
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
5 @variable item(data_object.BlogItem): item to display
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6 @variable identities(data_object.Identities): identities which can be used to display info on item author
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 @variable dates_format(unicode): format of the date to use (see date_fmt filter)
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8 #}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 {% block item %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 {% set item_level = (item_level or 0) + 1 %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 {% if item.language and locale and locale.language != item.language %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 {# we may display items in different language in a specific way #}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16 {% set other_lang = " other_lang" if expanded else " other_lang state_init" %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 {% endif %}
405
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
18 <article id="{{item.id}}" class="blog-item media px-4 py-3" >
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
19 {% if identities is defined %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
20 {% if avatar is defined %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 <div class="media-left">
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 {{ avatar.avatar(item.author_jid) }}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
23 </div>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
24 {% endif %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
25 {% endif %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 <div class="media-content">
247
40fccd3b7cf0 updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents: 246
diff changeset
27 {% set title = item.title_xhtml|safe or item.title%}
265
ae365c036a58 bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents: 251
diff changeset
28 {% set item_http_uri = items_http_uri.get(item.id) if items_http_uri is defined else none %}
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
29 {% if title %}
265
ae365c036a58 bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents: 251
diff changeset
30 <h4 class="title is-4">
ae365c036a58 bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents: 251
diff changeset
31 {% if item_http_uri %}
ae365c036a58 bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents: 251
diff changeset
32 <a href="{{item_http_uri}}" class="has-text-black">{{title}}</a>
ae365c036a58 bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents: 251
diff changeset
33 {% else %}
ae365c036a58 bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents: 251
diff changeset
34 {{title}}
ae365c036a58 bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents: 251
diff changeset
35 {% endif %}
ae365c036a58 bulma (blog/item): title are now clickable like in default theme
Goffi <goffi@goffi.org>
parents: 251
diff changeset
36 </h4>
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
37 {% endif %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
38 <div class="content">
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
39 <p class="subtitle is-6 has-text-grey">
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
40 {% set published = item.published|date_fmt(fmt=dates_format) %}
268
ce2fd7a3911d bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents: 265
diff changeset
41 {% if Identities is defined %}
ce2fd7a3911d bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents: 265
diff changeset
42 <strong>{{identities[item.author_jid].nicknames[0] if identities[item.author_jid].nicknames else item.author}}</strong>
ce2fd7a3911d bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents: 265
diff changeset
43 {% else %}
ce2fd7a3911d bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents: 265
diff changeset
44 <strong>{{item.author}}</strong>
ce2fd7a3911d bulma (blog/item): use nickname when available instead of jid
Goffi <goffi@goffi.org>
parents: 265
diff changeset
45 {% endif %}
353
ddcdc0475940 (bulma) blog/item: `published` timestamp now links to the item
Goffi <goffi@goffi.org>
parents: 344
diff changeset
46 {% if item_http_uri %}
ddcdc0475940 (bulma) blog/item: `published` timestamp now links to the item
Goffi <goffi@goffi.org>
parents: 344
diff changeset
47 <small><a href="{{item_http_uri}}" class="has-text-black">{{published}}</a></small>
ddcdc0475940 (bulma) blog/item: `published` timestamp now links to the item
Goffi <goffi@goffi.org>
parents: 344
diff changeset
48 {% else %}
ddcdc0475940 (bulma) blog/item: `published` timestamp now links to the item
Goffi <goffi@goffi.org>
parents: 344
diff changeset
49 <small>{{published}}</small>
ddcdc0475940 (bulma) blog/item: `published` timestamp now links to the item
Goffi <goffi@goffi.org>
parents: 344
diff changeset
50 {% endif %}
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
51 {% if item.tags %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
52 <small class="labels">
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
53 {% if tags_http_uri is defined %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
54 {% for tag in item.tags %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
55 <a href="{{tags_http_uri[tag]}}"><span class="tag is-rounded">{{tag}}</span></a>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
56 {% endfor %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
57 {% else %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
58 {% for tag in item.tags %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
59 <span class="tag">{{tag}}</span>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
60 {% endfor %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
61 {% endif %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
62 </small>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
63 {% endif %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
64 </p>
344
e982a05d43b1 blog/item, css: fix `white-space` for text content
Goffi <goffi@goffi.org>
parents: 268
diff changeset
65 {% if item.content_xhtml is defined %}
e982a05d43b1 blog/item, css: fix `white-space` for text content
Goffi <goffi@goffi.org>
parents: 268
diff changeset
66 {{item.content_xhtml|safe}}
e982a05d43b1 blog/item, css: fix `white-space` for text content
Goffi <goffi@goffi.org>
parents: 268
diff changeset
67 {% else %}
e982a05d43b1 blog/item, css: fix `white-space` for text content
Goffi <goffi@goffi.org>
parents: 268
diff changeset
68 <p class="is-text-content">
e982a05d43b1 blog/item, css: fix `white-space` for text content
Goffi <goffi@goffi.org>
parents: 268
diff changeset
69 {{- item.content|urlize -}}
e982a05d43b1 blog/item, css: fix `white-space` for text content
Goffi <goffi@goffi.org>
parents: 268
diff changeset
70 </p>
e982a05d43b1 blog/item, css: fix `white-space` for text content
Goffi <goffi@goffi.org>
parents: 268
diff changeset
71 {% endif %}
405
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
72
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
73 <div class="blog-item-footer"></div>
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
74
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
75 {# Actions #}
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
76 <div class="level mb-0 mt-1">
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
77 <div class="level-left">
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
78 <div class="level-item">
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
79 {#
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
80 <button
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
81 class="button is-small is-text has-text-grey is-rounded mr-2"
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
82 aria-label="{% trans %}Reply{% endtrans %}"
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
83 >
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
84 {{ icon('reply', cls='icon is-small') }}
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
85 </button>
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
86 #}
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
87
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
88 <button
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
89 class="reaction-button button is-small is-text has-text-grey is-rounded mr-2"
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
90 aria-label="{% trans %}React{% endtrans %}"
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
91 >
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
92 {{ icon('regular face-smile', cls='icon is-small') }}
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
93 </button>
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
94
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
95 <button
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
96 class="button is-small is-text has-text-grey is-rounded mr-2"
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
97 aria-label="{% trans %}Mark the post as noticed{% endtrans %}"
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
98 >
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
99 {{ icon('star', cls='icon is-small') }}
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
100 </button>
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
101
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
102 <button
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
103 class="button is-small is-text has-text-grey is-rounded"
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
104 aria-label="{% trans %}More options{% endtrans %}"
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
105 >
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
106 {{ icon('ellipsis', cls='icon is-small') }}
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
107 </button>
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
108 </div>
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
109 </div>
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
110 </div>
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
111
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 353
diff changeset
112 {# comments #}
247
40fccd3b7cf0 updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents: 246
diff changeset
113 {% for comments_data in item.comments %}
40fccd3b7cf0 updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents: 246
diff changeset
114 {% for item in comments_data['items'] %}
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
115 {% include 'blog/item.html' %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
116 {% endfor %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
117 {% if allow_commenting and item_level == 1 %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
118 <div class="comment_post">
247
40fccd3b7cf0 updated code to handle blog items following data structure change in backend/Libervia
Goffi <goffi@goffi.org>
parents: 246
diff changeset
119 {{- textbox.comment(service=comments_data.service, node=comments_data.node) -}}
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
120 </div>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
121 {% endif %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
122 {% endfor %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
123
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
124 </div>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
125 </div>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
126 </article>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
127
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
128 {% endblock item %}