Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show publication reference in listings #149

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
python_requires=">=3.8",
install_requires=[
"setuptools",
"eea.facetednavigation",
"ftw.upgrade",
"plone.api",
"collective.vdexvocabulary",
Expand Down
19 changes: 18 additions & 1 deletion src/recensio/plone/browser/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:faceted="http://namespaces.zope.org/faceted"
xmlns:plone="http://namespaces.plone.org/plone"
>

<include
package="z3c.jbot"
file="meta.zcml"
/>
<include
package="eea.facetednavigation"
file="meta.zcml"
/>
<browser:jbot
directory="overrides"
layer="recensio.plone.interfaces.IRecensioPloneLayer"
Expand Down Expand Up @@ -82,6 +87,17 @@

<!-- Listing views -->

<configure package="eea.facetednavigation.browser">
<browser:page
name="faceted_query"
for="..interfaces.IFacetedNavigable"
class="recensio.plone.browser.listing.RecensioFacetedQueryHandler"
template="template/query.pt"
permission="zope2.View"
layer="recensio.plone.interfaces.IRecensioPloneLayer"
/>
</configure>

<browser:page
name="sorting-menu"
for="*"
Expand All @@ -90,8 +106,9 @@
permission="zope2.View"
/>

<browser:page
<faceted:view
name="results-listing"
title="Review Results Listing"
for="*"
class=".listing.ResultsListing"
template="templates/results-listing.pt"
Expand Down
15 changes: 15 additions & 0 deletions src/recensio/plone/browser/listing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from eea.facetednavigation.browser.app.query import FacetedQueryHandler
from plone import api
from plone.app.contentlisting.interfaces import IContentListing
from Products.CMFPlone.browser.navtree import getNavigationRoot
from Products.CMFPlone.utils import normalizeString
from Products.Five.browser import BrowserView
Expand Down Expand Up @@ -26,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()
Expand All @@ -36,6 +46,7 @@ def items(self):
catalog = api.portal.get_tool("portal_catalog")
results = catalog(self.query)
IAnnotations(self.request)["recensio.query_results"] = results
results = IContentListing(results)
return results

def translate(self, msgid):
Expand All @@ -46,6 +57,10 @@ def translate(self, msgid):
)


class RecensioFacetedQueryHandler(FacetedQueryHandler, ListingBase):
"""Add recensio capabilities"""


class ReviewSectionsListing(ListingBase):
@property
def title(self):
Expand Down
2 changes: 1 addition & 1 deletion src/recensio/plone/browser/templates/latest-items.pt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
tal:condition="context/syndication-util/context_allowed"
></p>

<div metal:use-macro="context/results-listing/macros/results-listing"
<div metal:use-macro="context/results-listing/macros/content-core"
tal:condition="results"
></div>

Expand Down
Loading
Loading