Mercurial > libervia-web
comparison libervia/web/pages/chat/_browser/__init__.py @ 1632:8400d3b58515
browser (chat): Show Data Policy Panel on badge hover/touch.
If data policy and its score are set, add the event listener to show the panel when the
badge is hovered or touched.
rel 460
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 26 Jun 2025 17:12:37 +0200 |
parents | 84e287565fab |
children | 332822ceae85 |
comparison
equal
deleted
inserted
replaced
1631:d4dd4c94463c | 1632:8400d3b58515 |
---|---|
1 from html import escape | |
2 import json | 1 import json |
3 import re | 2 import re |
4 from typing import Callable | 3 from typing import Callable |
5 import errors | 4 import errors |
6 | 5 |
333 "identities": identities, | 332 "identities": identities, |
334 "chat_url": chat_url | 333 "chat_url": chat_url |
335 } | 334 } |
336 ) | 335 ) |
337 document["direct-messages"] <= direct_messages_elt | 336 document["direct-messages"] <= direct_messages_elt |
337 | |
338 # data policy | |
339 try: | |
340 data_policy = window.data_policy | |
341 except AttributeError: | |
342 pass | |
343 else: | |
344 data_policy_score = window.data_policy_score | |
345 data_policy_panel_tpl = Template("components/data_policy_panel.html") | |
346 data_policy_panel_elt = data_policy_panel_tpl.get_elt({ | |
347 "detail": data_policy["score"]["detail"], | |
348 "score": data_policy_score, | |
349 }) | |
350 tippy( | |
351 ".data-policy-badge", | |
352 { | |
353 "content": data_policy_panel_elt, | |
354 "appendTo": document.body, | |
355 "placement": "bottom", | |
356 "theme": "light", | |
357 } | |
358 ) | |
338 | 359 |
339 async def post_init(self) -> None: | 360 async def post_init(self) -> None: |
340 if chat_type == "group": | 361 if chat_type == "group": |
341 occupants = await bridge.muc_occupants_get( | 362 occupants = await bridge.muc_occupants_get( |
342 str(target_jid) | 363 str(target_jid) |