annotate sat_templates/templates/bulma/chat/message.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 66f98ee041d8
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 {% import 'components/avatar.html' as avatar with context %}
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
2
386
e63fb06052ae bulma: message edition + extra menu + improvments:
Goffi <goffi@goffi.org>
parents: 385
diff changeset
3 {% if chat_type == "group" %}
389
2eaea9a9c234 bulma (chat/message): fix setting of `own_mess` class.
Goffi <goffi@goffi.org>
parents: 387
diff changeset
4 {% set own_msg = msg.from_==own_local_jid %}
386
e63fb06052ae bulma: message edition + extra menu + improvments:
Goffi <goffi@goffi.org>
parents: 385
diff changeset
5 {% else %}
389
2eaea9a9c234 bulma (chat/message): fix setting of `own_mess` class.
Goffi <goffi@goffi.org>
parents: 387
diff changeset
6 {% set own_msg = msg.from_|bare_jid==own_local_jid|bare_jid %}
386
e63fb06052ae bulma: message edition + extra menu + improvments:
Goffi <goffi@goffi.org>
parents: 385
diff changeset
7 {% endif %}
e63fb06052ae bulma: message edition + extra menu + improvments:
Goffi <goffi@goffi.org>
parents: 385
diff changeset
8
e63fb06052ae bulma: message edition + extra menu + improvments:
Goffi <goffi@goffi.org>
parents: 385
diff changeset
9 <div
e63fb06052ae bulma: message edition + extra menu + improvments:
Goffi <goffi@goffi.org>
parents: 385
diff changeset
10 id="{{msg.id}}"
403
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
11 class="media chat-message msg_{{msg.type}} {{'own_msg' if own_msg}} {{ 'is-retracted' if msg.extra.retracted }}"
387
8b990c78d4b5 (bulma/chat): add menu + style for message retraction
Goffi <goffi@goffi.org>
parents: 386
diff changeset
12 aria-label="{{ 'Retracted Message' if msg.extra.retracted else 'Chat Message' }}"
404
66f98ee041d8 chat: add UI for replies/threads:
Goffi <goffi@goffi.org>
parents: 403
diff changeset
13 data-from='{{msg.from_}}'
386
e63fb06052ae bulma: message edition + extra menu + improvments:
Goffi <goffi@goffi.org>
parents: 385
diff changeset
14 {% if msg.extra.editions %}data-editions='{{msg.extra.editions|tojson}}'{% endif %}
404
66f98ee041d8 chat: add UI for replies/threads:
Goffi <goffi@goffi.org>
parents: 403
diff changeset
15 {% if msg.extra.thread %}data-thread='{{msg.extra.thread}}'{% endif %}
386
e63fb06052ae bulma: message edition + extra menu + improvments:
Goffi <goffi@goffi.org>
parents: 385
diff changeset
16 >
385
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
17 {%- if msg.type != "info" %}
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
18 {%- set author = identities[msg.from_].nicknames[0] | default(msg.from_) -%}
403
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
19 <figure class="media-left">
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
20 {{ avatar.avatar(msg.from_) }}
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 </figure>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 {% endif -%}
362
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
23 <div class="media-content is-relative">
385
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
24 {%- if msg.type != "info" %}
403
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
25
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
26 <div>
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
27
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
28 <span class="author" id="msg_author_{{msg.id}}">{{author}}</span>
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
29 <span class="date" id="msg_date_{{msg.id}}">{{(msg.extra.updated or msg.timestamp)|date_fmt('short', tz_name=tz_name)}}</span>
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
30 <span id="status_icons_{{msg.id}}" class="status-icons level-item has-padding-left">
404
66f98ee041d8 chat: add UI for replies/threads:
Goffi <goffi@goffi.org>
parents: 403
diff changeset
31 {% if msg.reply_to or msg.extra.thread %}
66f98ee041d8 chat: add UI for replies/threads:
Goffi <goffi@goffi.org>
parents: 403
diff changeset
32 {{ icon('comment-dots', cls='icon is-small message-thread') }}
66f98ee041d8 chat: add UI for replies/threads:
Goffi <goffi@goffi.org>
parents: 403
diff changeset
33 {% endif %}
403
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
34 {% if msg.extra.editions %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
35 {{ icon('pencil', cls='icon is-small message-editions') }}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
36 {% endif %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
37 {% if msg.encrypted %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
38 {{ icon('lock-filled', cls='icon is-small has-text-success') }}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
39 {% else %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
40 {{ icon('lock-open', cls='icon is-small has-text-danger') }}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
41 {% endif %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
42 {% if msg.received %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
43 {{ icon('ok', cls='icon is-small has-text-link') }}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
44 {% endif %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
45 {% if msg.edited %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
46 {{ icon('pencil', cls='icon is-small has-text-info') }}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
47 {% endif %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
48 </span>
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
49 </div>
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
50
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
51 {% endif -%}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
52 <div class="message-core">
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
53 <p class="message-body {{ "has-text-info" if msg.type=="info" or msg.extra.retracted }} m-0" id="message-body_{{msg.id}}">
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
54 {%- if msg.extra.retracted %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
55 {% trans %}This message has been retracted.{% endtrans %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
56 {% else %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
57 {{- msg.html or (msg.text|e|urlize|safe) -}}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
58 {% endif -%}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
59 </p>
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
60
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
61 <div class="url-previews is-hidden">
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
62 <div class="icon-container"></div>
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
63 </div>
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
64
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
65 <div
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
66 id="actions_{{msg.id}}"
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
67 class="level message-actions mb-0 mt-1 {{ "is-hidden" if msg.extra.retracted }}"
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
68 >
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
69 <div class="level-left"></div>
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
70 <div class="level-right">
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
71 {# {{ icon('share-nodes', cls='icon is-small action-button', id='msg_share_' + msg.id) }} #}
404
66f98ee041d8 chat: add UI for replies/threads:
Goffi <goffi@goffi.org>
parents: 403
diff changeset
72 {{ icon('reply', cls='icon is-small action-button reply-button')}}
66f98ee041d8 chat: add UI for replies/threads:
Goffi <goffi@goffi.org>
parents: 403
diff changeset
73 {{ icon('regular face-smile', cls='icon is-small action-button reaction-button') }}
66f98ee041d8 chat: add UI for replies/threads:
Goffi <goffi@goffi.org>
parents: 403
diff changeset
74 {{ icon('ellipsis', cls='icon is-small action-button extra-button') }}
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
75 </div>
403
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
76 </div>
364
095bd5b34080 chat: add templates for URL previews
Goffi <goffi@goffi.org>
parents: 363
diff changeset
77
403
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
78 <div id="msg_reactions_{{msg.id}}">
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
79 {% if msg.extra.reactions is defined %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
80 {% set reactions = msg.extra.get("reactions") %}
405
5016fb0ff62f Blog redesign: work in progress redesign of the blog.
Goffi <goffi@goffi.org>
parents: 404
diff changeset
81 {% include 'components/reactions.html' %}
403
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
82 {% endif %}
65c53ec5e777 Bulma: complete redesign:
Goffi <goffi@goffi.org>
parents: 389
diff changeset
83 </div>
362
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
84 </div>
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
85 {% if msg.attachments %}
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
86 <div class="message-attachments pt-2">
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
87 {%- for attachment in msg.attachments %}
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
88 <figure class="image message-attachment">
385
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
89 {%- if not attachment.url -%}
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
90 <div class="notification is-warning">
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
91 <div class="is-size-6 has-text-weight-semibold mb-1">
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
92 {% trans name=attachment.name %}Attachment: {{name}}{% endtrans %}
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
93 </div>
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
94
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
95 <div class="is-size-7 mb-1">
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
96 {% trans %}Cannot be opened as there are no sources available.{% endtrans %}
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
97 </div>
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
98
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
99 </div>
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
100 {%- else -%}
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
101 {%- if attachment.media_type|media_type_main == 'image' %}
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
102 <img src="{{attachment.url}}" alt="{{attachment.name}}">
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
103 {%- else %}
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
104 {{ icon('doc', cls='icon') }}
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
105 {%- endif %}
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
106 <figcaption class="has-text-centered is-size-7">
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
107 <a href="{{attachment.url}}" target="_blank" class="has-text-grey">{{attachment.name}}</a>
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
108 </figcaption>
941e4006ab6e bulma (message): reactions + fixes:
Goffi <goffi@goffi.org>
parents: 371
diff changeset
109 {%- endif -%}
362
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
110 </figure>
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
111 {%- endfor %}
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
112 </div>
b2b859a62e70 bulma (chat): new templates and CSS for chat page.
Goffi <goffi@goffi.org>
parents: 235
diff changeset
113 {% endif %}
230
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
114 </div>
0e69b5843c2f theme: bulma theme first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
115 </div>