diff libervia/pages/lists/view/_browser/__init__.py @ 1387:a84383c659b4

lists: creation, invitation, item deletion: this big patch includes: - reorganisation of pages for consistency, discovery is now the main list page, and list overview is now in `view` while item view is moved to `view_item` - lists from lists of interest are now shown in discovery page - list deletion from discory page - list can now be created, using templates now available from backend - invitation manager can now be used from list overview - list item can now be deleted from `view_item`
author Goffi <goffi@goffi.org>
date Sat, 20 Feb 2021 14:07:22 +0100
parents
children 4ccf42d8aab7
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libervia/pages/lists/view/_browser/__init__.py	Sat Feb 20 14:07:22 2021 +0100
@@ -0,0 +1,31 @@
+from browser import window, bind
+from invitation import InvitationManager
+
+
+lists_ns = window.lists_ns
+pubsub_service = window.pubsub_service
+pubsub_node = window.pubsub_node
+try:
+    affiliations = window.affiliations.to_dict()
+except AttributeError:
+    pass
+
+@bind("#button_manage", "click")
+def manage_click(evt):
+    evt.stopPropagation()
+    evt.preventDefault()
+    pubsub_data = {
+        "namespace": lists_ns,
+        "service": pubsub_service,
+        "node": pubsub_node
+    }
+    try:
+        name = pubsub_node.split('_', 1)[1]
+    except IndexError:
+        pass
+    else:
+        name = name.strip()
+        if name:
+            pubsub_data['name'] = name
+    manager = InvitationManager("pubsub", pubsub_data)
+    manager.attach(affiliations=affiliations)