Mercurial > libervia-web
view libervia/web/pages/events/_browser/__init__.py @ 1557:855729ef75f2
browser (calls): improve call buttons:
- following template change, there are now a call button for video and one for audio, and
no more "switch" button, this is more intuitive
- search items have been customised with a 3 dots menu to show a dropdown, which let
select the "video" or "audio" call mode. By defaut, a click on a search item will do a
video call.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 15 Aug 2023 17:16:45 +0200 |
parents | eb00d593801d |
children |
line wrap: on
line source
from browser import DOMNode, document, aio from javascript import JSON from bridge import AsyncBridge as Bridge, BridgeException import dialog bridge = Bridge() async def on_delete(evt): evt.stopPropagation() evt.preventDefault() target = evt.currentTarget item_elt = DOMNode(target.closest('.item')) item_elt.classList.add("selected_for_deletion") item = JSON.parse(item_elt.dataset.item) confirmed = await dialog.Confirm( f"Event {item['name']!r} will be deleted, are you sure?", ok_label="delete", ).ashow() if not confirmed: item_elt.classList.remove("selected_for_deletion") return try: await bridge.interest_retract("", item['interest_id']) except BridgeException as e: dialog.notification.show( f"Can't remove list {item['name']!r} from personal interests: {e}", "error" ) else: print(f"{item['name']!r} removed successfuly from list of interests") item_elt.classList.add("state_deleted") item_elt.bind("transitionend", lambda evt: item_elt.remove()) if item.get("creator", False): try: await bridge.ps_node_delete( item['service'], item['node'], ) except BridgeException as e: dialog.notification.show( f"Error while deleting {item['name']!r}: {e}", "error" ) else: dialog.notification.show(f"{item['name']!r} has been deleted") for elt in document.select('.action_delete'): elt.bind("click", lambda evt: aio.run(on_delete(evt)))