Skip to content

Commit

Permalink
Sort options for faceted navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhardt committed Feb 14, 2024
1 parent 54a3d8d commit 980ddb9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/recensio/plone/vocabularies/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@
component=".languages.AvailableContentLanguagesFactory"
/>

<utility
factory=".sort_options.SortOptionsVocabulary"
name="recensio.plone.vocabularies.sort_options"
/>

</configure>
19 changes: 19 additions & 0 deletions src/recensio/plone/vocabularies/sort_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from recensio.plone import _
from zope.interface import implementer
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary


@implementer(IVocabularyFactory)
class SortOptionsVocabulary:
def __call__(self, *args, **kwargs):
options = {
"relevance": _("Relevance"),
"sortable_title": _("Titel/alphabetisch"),
"modified": _("label_modification_date"),
"created": _("label_creation_date", default="Erstellungsdatum"),
}
return SimpleVocabulary(
[SimpleTerm(key, key, value) for key, value in options.items()]
)

0 comments on commit 980ddb9

Please sign in to comment.