Skip to content
Open
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
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
4.1 (unreleased)
----------------

- Nothing changed yet.
- fix filteritems for `FilterTile.content_selector` when multiple contentlisting tiles are on one page.
[petschki]


4.0 (2022-05-10)
Expand Down Expand Up @@ -56,7 +57,6 @@ Bug Fixes:
- Fixed searches for only non-alphanumeric characters causing an exception to be displayed.
[JeffersonBledsoe]


Other:

- Code-Style Black and Isort
Expand Down
22 changes: 11 additions & 11 deletions src/collective/collectionfilter/tiles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,13 @@ def __init__(self, context):
"""Adapt either collections or contentlisting tile. The name is sorted content selector"""
self.context = context

self.selectContent("") # get first tile

if self.tile is None:
# Could still be a ILayoutAware collection
try:
self.collection = ICollection(self.context)
except TypeError:
self.collection = None
else:
self.collection = self.tile # to get properties
# self.context might not be adaptable
# make sure you select the right content with
# selectContent(selector) after initialization
try:
self.collection = ICollection(self.context)
except TypeError:
self.collection = None

def selectContent(self, selector=None):
"""Pick tile that selector will match, otherwise pick first one.
Expand All @@ -129,7 +126,10 @@ def selectContent(self, selector=None):
# TODO: what if the class is inside a special template? Just pick first?
# none of the selectors worked. Just pick any and hope it works?
self.tile = tile
if self.tile is not None or self.collection is not None:
if self.tile is not None:
# we have to set self.collection always to self.tile to get the
# correct query
self.collection = self.tile
return self

@property
Expand Down