view libervia/pages/lists/view/_browser/__init__.py @ 1389:ac4173fff71d

pages (lists/view): add `list_type` to `template_data`: when a service/node is used for the first time, schema is retrieved, and `list_type` is put in cache and used in template. This allows the template to have specialised views depending on the kind of list user is opening.
author Goffi <goffi@goffi.org>
date Sat, 27 Feb 2021 20:58:22 +0100
parents a84383c659b4
children 4ccf42d8aab7
line wrap: on
line source

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)