from functools import cached_property
from onegov.core.elements import Link
from onegov.landsgemeinde import _
from onegov.landsgemeinde.layouts.default import DefaultLayout
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from onegov.landsgemeinde.models import Votum
from onegov.landsgemeinde.request import LandsgemeindeRequest
[docs]
class VotumCollectionLayout(DefaultLayout):
@cached_property
[docs]
def title(self) -> str:
return _(
'Vota of agenda items ${number} of assembly from ${date}',
mapping={
'number': self.model.agenda_item_number,
'date': self.format_date(self.model.date, 'date_long')
}
)
@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.assembly_title(self.model.assembly),
self.request.link(self.model.assembly)
),
Link(
self.agenda_item_title(self.model.agenda_item, short=True),
self.request.link(self.model.agenda_item)
),
Link(_('Vota'), self.request.link(self.model))
]
[docs]
class VotumLayout(DefaultLayout):
if TYPE_CHECKING:
def __init__(
self,
model: Votum,
request: LandsgemeindeRequest
) -> None: ...
@cached_property
[docs]
def title(self) -> str:
return self.votum_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.assembly_title(self.model.agenda_item.assembly),
self.request.link(self.model.agenda_item.assembly)
),
Link(
self.agenda_item_title(self.model.agenda_item, short=True),
self.request.link(self.model.agenda_item)
),
Link(self.title, '#')
]