Source code for landsgemeinde.layouts.assembly

from functools import cached_property
from onegov.core.elements import Confirm
from onegov.core.elements import Intercooler
from onegov.core.elements import Link
from onegov.core.elements import LinkGroup
from onegov.landsgemeinde import _
from onegov.landsgemeinde.collections import AgendaItemCollection
from onegov.landsgemeinde.layouts.default import DefaultLayout


from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from onegov.landsgemeinde.models import Assembly
    from onegov.landsgemeinde.request import LandsgemeindeRequest


[docs] class AssemblyCollectionLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return _('Assemblies')
@cached_property
[docs] def og_description(self) -> str: return self.request.translate(self.title)
@cached_property
[docs] def breadcrumbs(self) -> list[Link]: return [ Link(_('Homepage'), self.homepage_url), Link(self.title, self.request.link(self.model)) ]
@cached_property
[docs] class AssemblyLayout(DefaultLayout): if TYPE_CHECKING:
[docs] model: Assembly
def __init__( self, model: Assembly, request: LandsgemeindeRequest ) -> None: ... @cached_property
[docs] def title(self) -> str: return self.assembly_title(self.model)
@cached_property
[docs] def og_description(self) -> str: return self.request.translate(self.title)
@cached_property
[docs] def breadcrumbs(self) -> list[Link]: return [ Link(_('Homepage'), self.homepage_url), Link( _('Assemblies'), self.request.link(self.assembly_collection()) ), Link(self.title, self.request.link(self.model)) ]
@cached_property
[docs] class AssemblyTickerLayout(DefaultLayout):
[docs] model: 'Assembly'
def __init__( self, model: 'Assembly', request: 'LandsgemeindeRequest' ) -> None: super().__init__(model, request) self.request.include('websockets') self.request.include('ticker') self.custom_body_attributes['data-websocket-endpoint'] = ( self.app.websockets_client_url(request)) self.custom_body_attributes['data-websocket-schema'] = ( self.app.schema) @cached_property
[docs] def title(self) -> str: return self.assembly_title(self.model)
@cached_property
[docs] def og_description(self) -> str: return self.request.translate(self.title)
@cached_property
[docs] def breadcrumbs(self) -> list[Link]: return [ Link(_('Homepage'), self.homepage_url), Link(_('Ticker'), self.request.link(self.model, name='ticker')) ]
[docs] def current_assembly(self) -> None: # This way the lifeticker bar won't be displayed return None