Mercurial > libervia-web
diff 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 |
line wrap: on
line diff
--- a/libervia/web/pages/chat/_browser/__init__.py Thu Jun 26 17:10:41 2025 +0200 +++ b/libervia/web/pages/chat/_browser/__init__.py Thu Jun 26 17:12:37 2025 +0200 @@ -1,4 +1,3 @@ -from html import escape import json import re from typing import Callable @@ -336,6 +335,28 @@ ) document["direct-messages"] <= direct_messages_elt + # data policy + try: + data_policy = window.data_policy + except AttributeError: + pass + else: + data_policy_score = window.data_policy_score + data_policy_panel_tpl = Template("components/data_policy_panel.html") + data_policy_panel_elt = data_policy_panel_tpl.get_elt({ + "detail": data_policy["score"]["detail"], + "score": data_policy_score, + }) + tippy( + ".data-policy-badge", + { + "content": data_policy_panel_elt, + "appendTo": document.body, + "placement": "bottom", + "theme": "light", + } + ) + async def post_init(self) -> None: if chat_type == "group": occupants = await bridge.muc_occupants_get(