Source code for swissvotes.layouts.votes

from functools import cached_property
from onegov.core.elements import Link
from onegov.core.elements import LinkGroup
from onegov.swissvotes import _
from onegov.swissvotes.layouts.default import DefaultLayout


from typing import TYPE_CHECKING
if TYPE_CHECKING:
    from onegov.swissvotes.collections import SwissVoteCollection
    from onegov.swissvotes.request import SwissvotesRequest


[docs] class VotesLayout(DefaultLayout): if TYPE_CHECKING:
[docs] model: SwissVoteCollection
def __init__( self, model: SwissVoteCollection, request: SwissvotesRequest ) -> None: ... @cached_property
[docs] def title(self) -> str: return _('Votes')
@cached_property @cached_property
[docs] def breadcrumbs(self) -> list[Link]: return [ Link(_('Homepage'), self.homepage_url), Link(self.title, self.votes_url), ]
[docs] class VotesActionLayout(DefaultLayout): @cached_property
[docs] def title(self) -> str: raise NotImplementedError()
@cached_property
[docs] def breadcrumbs(self) -> list[Link]: return [ Link(_('Homepage'), self.homepage_url), Link(_('Votes'), self.votes_url), Link(self.title, '#'), ]
[docs] class UpdateVotesLayout(VotesActionLayout): @cached_property
[docs] def title(self) -> str: return _('Update dataset on the votes')
[docs] class UpdateMetadataLayout(VotesActionLayout): @cached_property
[docs] def title(self) -> str: return _('Update metadata on the campaign material')
[docs] class UpdateExternalResourcesLayout(VotesActionLayout): @cached_property
[docs] def title(self) -> str: return _('Update external sources for images')
[docs] class DeleteVotesLayout(VotesActionLayout): @cached_property
[docs] def title(self) -> str: return _('Delete all votes')