Source code for wtfs.layouts.notification

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.wtfs import _
from onegov.wtfs.layouts.default import DefaultLayout
from onegov.wtfs.security import AddModel
from onegov.wtfs.security import DeleteModel
from onegov.wtfs.security import EditModel


from typing import TYPE_CHECKING
if TYPE_CHECKING:
    from onegov.core.elements import Element


[docs] class NotificationsLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return _('Notifications')
@cached_property @cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_('Homepage'), self.homepage_url), Link(self.title, self.notifications_url) ]
[docs] class NotificationLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return self.model.title
@cached_property @cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_('Homepage'), self.homepage_url), Link(_('Notifications'), self.notifications_url), Link(self.title, '#') ]
[docs] class AddNotificationLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return _('Add notification')
@cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_('Homepage'), self.homepage_url), Link(_('Notifications'), self.notifications_url), Link(_('Add'), '#') ]
@cached_property
[docs] def cancel_url(self) -> str: return self.notifications_url
@cached_property
[docs] def success_url(self) -> str: return self.notifications_url
[docs] class EditNotificationLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return _('Edit notification')
@cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_('Homepage'), self.homepage_url), Link(_('Notifications'), self.notifications_url), Link(self.model.title, self.request.link(self.model)), Link(_('Edit'), '#') ]
@cached_property
[docs] def cancel_url(self) -> str: return self.request.link(self.model)
@cached_property
[docs] def success_url(self) -> str: return self.request.link(self.model)