Source code for wtfs.layouts.municipality

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 MunicipalitiesLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return _("Municipalities")
@cached_property @cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_("Homepage"), self.homepage_url), Link(self.title, self.municipalities_url) ]
[docs] class ImportMunicipalityDataLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return _("Import data")
@cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_("Homepage"), self.homepage_url), Link(_("Municipalities"), self.municipalities_url), Link(self.title, '#') ]
@cached_property
[docs] def cancel_url(self) -> str: return self.municipalities_url
@cached_property
[docs] def success_url(self) -> str: return self.municipalities_url
[docs] class MunicipalityLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return self.model.name
@cached_property @cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_("Homepage"), self.homepage_url), Link(_("Municipalities"), self.municipalities_url), Link(self.title, '#') ]
[docs] class AddMunicipalityLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return _("Add municipality")
@cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_("Homepage"), self.homepage_url), Link(_("Municipalities"), self.municipalities_url), Link(_("Add"), '#') ]
@cached_property
[docs] def cancel_url(self) -> str: return self.municipalities_url
@cached_property
[docs] def success_url(self) -> str: return self.municipalities_url
[docs] class EditMunicipalityLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return _("Edit municipality")
@cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_("Homepage"), self.homepage_url), Link(_("Municipalities"), self.municipalities_url), Link(self.model.name, 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.municipalities_url
[docs] class DeleteMunicipalityDatesLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: return _("Delete pick-up dates")
@cached_property
[docs] def breadcrumbs(self) -> list['Element']: return [ Link(_("Homepage"), self.homepage_url), Link(_("Municipalities"), self.municipalities_url), Link(self.model.name, self.request.link(self.model)), Link(self.title, '#') ]
@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)