From 04c9cbad1dc2c6c0315268c2f754649f930c9883 Mon Sep 17 00:00:00 2001 From: Manuel Reinhardt Date: Fri, 9 Feb 2024 11:13:49 +0100 Subject: [PATCH 1/2] Make results-listing available to facetednavigation syslabcom/scrum#1939 --- setup.py | 1 + src/recensio/plone/browser/configure.zcml | 19 +- src/recensio/plone/browser/listing.py | 10 + .../plone/browser/templates/latest-items.pt | 2 +- .../browser/templates/results-listing.pt | 457 +++++++++--------- 5 files changed, 261 insertions(+), 228 deletions(-) diff --git a/setup.py b/setup.py index 0db32af..65b6395 100644 --- a/setup.py +++ b/setup.py @@ -46,6 +46,7 @@ python_requires=">=3.8", install_requires=[ "setuptools", + "eea.facetednavigation", "ftw.upgrade", "plone.api", "collective.vdexvocabulary", diff --git a/src/recensio/plone/browser/configure.zcml b/src/recensio/plone/browser/configure.zcml index 648eb7a..f7f4751 100644 --- a/src/recensio/plone/browser/configure.zcml +++ b/src/recensio/plone/browser/configure.zcml @@ -1,6 +1,7 @@ @@ -8,6 +9,10 @@ package="z3c.jbot" file="meta.zcml" /> + + + + + -

-
diff --git a/src/recensio/plone/browser/templates/results-listing.pt b/src/recensio/plone/browser/templates/results-listing.pt index 18b4717..4d0e997 100644 --- a/src/recensio/plone/browser/templates/results-listing.pt +++ b/src/recensio/plone/browser/templates/results-listing.pt @@ -3,6 +3,7 @@ xmlns:metal="http://xml.zope.org/namespaces/metal" xmlns:tal="http://xml.zope.org/namespaces/tal" lang="en" + metal:use-macro="context/main_template/macros/master" xml:lang="en" i18n:domain="recensio" > @@ -21,259 +22,263 @@ Subscribe to an always-updated feed of these search terms

-
+ + +
-
- - -
+
+ + +
- ${result_type} -
+ + + + + +
+ -
+
- + - - + + Published - - + + August 16, 2001 at 23:35:59 - - + + - + — - Schlagwörter: - - , - - + Schlagwörter: + + , + + - + — - + Relevance: - 23% - - - + 23% + + + - — - Recensio.net + — + Recensio.net -
+ - - - + + + -
-
+
+ + + From 3d693c8c930aeccf44bf7fc60747f78db2e129fe Mon Sep 17 00:00:00 2001 From: Manuel Reinhardt Date: Fri, 9 Feb 2024 15:45:33 +0100 Subject: [PATCH 2/2] Show publication reference in listings syslabcom/scrum#1939 --- src/recensio/plone/browser/listing.py | 19 ++++++++++++------- .../browser/templates/results-listing.pt | 13 ++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/recensio/plone/browser/listing.py b/src/recensio/plone/browser/listing.py index 4f91a14..7826fbb 100644 --- a/src/recensio/plone/browser/listing.py +++ b/src/recensio/plone/browser/listing.py @@ -11,13 +11,6 @@ from ZTUtils import make_query -class RecensioFacetedQueryHandler(FacetedQueryHandler): - """Add recensio capabilities""" - - def punctuated_title_and_subtitle(self, obj): - return punctuated_title_and_subtitle(obj) - - class ResultsListing(BrowserView): """Lists search results.""" @@ -35,6 +28,14 @@ class ListingBase(BrowserView): def punctuated_title_and_subtitle(self, obj): return punctuated_title_and_subtitle(obj) + def publication_reference(self, item): + obj = item.getObject() + view = api.content.get_view( + context=obj, request=self.request, name="breadcrumbs_view" + ) + breadcrumbs = list(view.breadcrumbs())[2:-1] + return ", ".join([crumb["Title"] for crumb in breadcrumbs]) + @property def rss_url(self): portal_url = api.portal.get().absolute_url() @@ -56,6 +57,10 @@ def translate(self, msgid): ) +class RecensioFacetedQueryHandler(FacetedQueryHandler, ListingBase): + """Add recensio capabilities""" + + class ReviewSectionsListing(ListingBase): @property def title(self): diff --git a/src/recensio/plone/browser/templates/results-listing.pt b/src/recensio/plone/browser/templates/results-listing.pt index 4d0e997..aa548be 100644 --- a/src/recensio/plone/browser/templates/results-listing.pt +++ b/src/recensio/plone/browser/templates/results-listing.pt @@ -171,6 +171,9 @@
@@ -183,13 +186,9 @@ / , - - in: - , - , - + + in: + , p.