from functools import cached_property
from onegov.core.elements import Link
from onegov.wtfs import _
from onegov.wtfs.layouts.default import DefaultLayout
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from onegov.core.elements import Element
[docs]
class DailyListLayout(DefaultLayout):
@cached_property
[docs]
def title(self) -> str:
return _('Daily list')
@cached_property
[docs]
def breadcrumbs(self) -> list['Element']:
return [
Link(_('Homepage'), self.homepage_url),
Link(self.title, self.request.link(self.model)),
]
[docs]
class SpecificDailyListBaseLayout(DefaultLayout):
@cached_property
[docs]
def subtitle(self) -> str:
return self.format_date(self.model.date, 'date_custom')
@cached_property
[docs]
def editbar_links(self) -> list['Element']:
return [
Link(
text=_('Print'),
url='#',
attrs={
'class': 'print-icon',
}
)
]
@cached_property
[docs]
def breadcrumbs(self) -> list['Element']:
return [
Link(_('Homepage'), self.homepage_url),
Link(_('Daily list'), self.daily_list_url),
Link(self.title, '#'),
Link(self.subtitle, self.request.link(self.model)),
]
[docs]
class DailyListBoxesLayout(SpecificDailyListBaseLayout):
@cached_property
[docs]
def title(self) -> str:
return _('Boxes')