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

Disable _all_ filter option #138

Open
wants to merge 115 commits into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 111 commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
407ed3f
Add idx parameter to display_modifier call
MrTango May 19, 2021
8d43269
Update reame for new display_modifier paramter
MrTango May 26, 2021
face5fb
Merge pull request #127 from collective/update-translations-de
agitator May 26, 2021
a6b2cb4
Merge branch 'master' into mrtango-integrate-taxonomy
agitator May 26, 2021
0e137b7
Merge pull request #126 from collective/mrtango-integrate-taxonomy
agitator May 26, 2021
063d182
implement AJAX geoJSON feature
petschki Feb 15, 2021
8d7e170
update filtered geoJSON data
petschki Feb 15, 2021
122af8a
depend on development version
petschki Feb 16, 2021
384b2ab
implement plone-loader with new pat-leaflet events
petschki Feb 16, 2021
f9b2268
limit for geojson properties
petschki Feb 19, 2021
a0ab115
Merge pull request #117 from collective/ajax-geojson
petschki May 27, 2021
3254bc9
Revert "implement AJAX geoJSON feature"
petschki May 28, 2021
1d09003
Merge pull request #129 from collective/revert-117-ajax-geojson
petschki May 28, 2021
84781fd
target listingtiles or collections and add layer to tests tiles
djay Jun 18, 2021
ee38cff
flake8
djay Jun 18, 2021
cddc925
Ensure right version of standardtiles
djay Jun 18, 2021
ff3dd34
fix 5.1 versions for 2.4.0 standardtiles
djay Jun 18, 2021
28f534f
move collectionish tile code to .tiles
djay Jun 24, 2021
2e23cc6
target only collections if no mosaic
djay Jun 24, 2021
98074b5
will pick right selector automatically
djay Jun 24, 2021
10222c0
flake8
djay Jun 24, 2021
c5b4e59
handle multiple listing tiles on one page
djay Jun 24, 2021
73030b9
README typos and extra_requires for mosaic with version pins
petschki Jun 25, 2021
8ffdbe2
fix example format
petschki Jun 25, 2021
80f8de7
add warning tiles with no listing, and don't validate tile targets
djay Jun 29, 2021
f5bb4e8
Merge branch 'collectionish' of github.com:collective/collective.coll…
djay Jun 29, 2021
a2ec45f
tile tests use testdoc instead of collection
djay Jun 29, 2021
d8b2c48
don't throw error when adding tile without listing
djay Jun 29, 2021
9186bf9
use plone.api to show_message
djay Jun 29, 2021
b1fc745
test tile shows warning on tile save when no listing
djay Jun 30, 2021
d2ad1ed
use .content_selector to determine if listing is available
djay Jun 30, 2021
eefcb8a
fix bug in test setup for tiles
djay Jun 30, 2021
a67331d
fix select collection when no tile
djay Jun 30, 2021
3358c2c
fix bug in filter portlet
djay Jun 30, 2021
afaeff4
bit more time in test to click alert
djay Jun 30, 2021
a07083a
try to fix alert workaround in test
djay Jun 30, 2021
08ba240
try no alert bug handling
djay Jul 1, 2021
5656d5b
try and ignore invisible alert
djay Jul 1, 2021
411cc92
show bug more clearly
djay Jul 1, 2021
3e1faad
improve tests by checking actual options shown
djay Jul 1, 2021
e1d6b1c
fix bug in tests caused by Type DX field not being inited properly
djay Jul 1, 2021
4bc8ea0
insert tiles in order
djay Jul 1, 2021
27ce5d0
fix for loop robot syntax
djay Jul 1, 2021
7b3da35
fix compile resources running
djay Jul 1, 2021
a20024e
gve warning anytime mosaic page saved and no listing
djay Jul 12, 2021
5c1350d
Merge pull request #133 from collective/collectionish
agitator Jul 19, 2021
21c2889
Add initial robot test
JeffersonBledsoe Aug 31, 2021
380d9a0
Add option to interface
JeffersonBledsoe Aug 31, 2021
d976e40
Update test
JeffersonBledsoe Aug 31, 2021
c8075a4
Add missing init arguments
JeffersonBledsoe Aug 31, 2021
b7f6077
Only include "All" option if enabled
JeffersonBledsoe Aug 31, 2021
cec438e
Fix cache_key
JeffersonBledsoe Sep 1, 2021
04b7d7e
Fix typo
JeffersonBledsoe Sep 2, 2021
885911f
Redirect if we don't have `collectionfilter=1` to make sure we can al…
JeffersonBledsoe Sep 3, 2021
10d6b96
flake8-black
jensens Sep 20, 2021
10f578b
isort and black
jensens Sep 20, 2021
9e4eeb0
test with black
jensens Sep 20, 2021
9cbc96a
no coverage in 3.8
jensens Sep 20, 2021
1d011f7
Merge pull request #142 from collective/black
jensens Sep 20, 2021
97b42e9
Fix sortkey function to not break if the title is not a string
jensens Sep 16, 2021
0787f7d
Merge pull request #140 from collective/fix-sort-key-func
jensens Sep 20, 2021
c232f89
Fixed searches for only non-alphanumeric characters causing an except…
JeffersonBledsoe Sep 21, 2021
1dc0609
Merge pull request #139 from collective/non-alphanumeric-search-excep…
petschki Sep 30, 2021
50f4d55
Make sure "All" is always translated
agitator Oct 12, 2021
24e7df2
update changelog
agitator Oct 12, 2021
4802e75
whitespaces
agitator Oct 12, 2021
ed5cdd1
python27 testing version pins
petschki Oct 13, 2021
637437f
black
petschki Oct 13, 2021
f1dad20
Merge pull request #143 from collective/translate-all
agitator Oct 13, 2021
3104e09
TODO noting linting issue
JeffersonBledsoe Oct 20, 2021
36686d8
Use list comprehension to tidy up code
JeffersonBledsoe Oct 20, 2021
3d9ce1d
Refactor the body of filter items into reusable functions
JeffersonBledsoe Oct 20, 2021
d8aadd8
Fix build
JeffersonBledsoe Oct 20, 2021
b91b7c9
Simplify if statements
JeffersonBledsoe Oct 20, 2021
5b4bcbe
Move flake8-ignore to buildout base
JeffersonBledsoe Oct 20, 2021
811bb69
Move option_url out of the for loop as it can be calculated earlier
JeffersonBledsoe Oct 20, 2021
e707345
Flake8 ignore
JeffersonBledsoe Oct 20, 2021
9ac8ef7
Update flake8 python2.7 support to fix incorrect failing flake8 issue
JeffersonBledsoe Oct 20, 2021
1239d50
Ignore W503
JeffersonBledsoe Oct 20, 2021
9ff2694
Consolidate python2.7 specific versions into the base.py config
JeffersonBledsoe Oct 20, 2021
50652d8
Ensure value blocklist is always iterable
JeffersonBledsoe Oct 20, 2021
3c4a114
Fix failing build
JeffersonBledsoe Oct 20, 2021
9050c35
Pin contextlib2 for python2.7 support
JeffersonBledsoe Oct 20, 2021
eac447b
Remove unwanted pass
JeffersonBledsoe Oct 22, 2021
75b0891
Merge pull request #144 from collective/jeffersonbledsoe/refactor
petschki Oct 22, 2021
547852b
Fix typo
JeffersonBledsoe Nov 10, 2021
0ca252e
Fix handling edge cases of existing values when redirecting
JeffersonBledsoe Nov 10, 2021
72606f5
Merge branch 'master' into disable-all-option
JeffersonBledsoe Nov 10, 2021
78b2da4
Fix setting up collection filter tile
JeffersonBledsoe Nov 11, 2021
5ec1687
Fix all filter
JeffersonBledsoe Nov 12, 2021
4414dbe
Fix unicode filtering
JeffersonBledsoe Nov 12, 2021
9b47316
Update test
JeffersonBledsoe Nov 12, 2021
395bf63
Fix Plone 5.2 build
JeffersonBledsoe Nov 12, 2021
8842f45
Fix 5.2 build with python 3
JeffersonBledsoe Nov 16, 2021
5482a98
ensure build happens on main
djay Nov 17, 2021
cf00269
Merge pull request #146 from collective/5.2-test-build-fix
djay Nov 17, 2021
5d6c4df
Fix for first option still showing all content
JeffersonBledsoe Nov 18, 2021
b23fb20
Fix typo in uninstall profiles causing Map and Sort portlets to remai…
JeffersonBledsoe Nov 24, 2021
57d713e
Merge pull request #147 from collective/uninstall-profile-typo-fix
petschki Nov 25, 2021
fe79553
try to fix bug with leave site popup
djay Nov 25, 2021
a3f65b7
include missing unit tests in actions
djay Nov 26, 2021
606ed88
run unit tests on py3
djay Nov 26, 2021
327cf32
fix run unit on py3
djay Nov 26, 2021
615d775
less error prone matrix using excludes
djay Nov 26, 2021
49e885a
Merge pull request #148 from collective/fix_flaky_robot
petschki Nov 26, 2021
304bde5
Merge branch 'master' into disable-all-option
djay Nov 29, 2021
076e22c
black
djay Nov 29, 2021
dfe3913
fix redirect to include full url. should fix rendering in tile edit
djay Nov 30, 2021
92604aa
missed change
djay Nov 30, 2021
67afc0e
do redirect with tiles but not while editing
djay Dec 1, 2021
4ee375c
fix redirect for tiles
djay Dec 1, 2021
f50501e
Fix deselect when self-selecting the filter
JeffersonBledsoe Feb 10, 2022
0fca0f7
Fix test
JeffersonBledsoe Mar 2, 2022
29e7b2c
Fix portlet exception if no results
JeffersonBledsoe Mar 7, 2022
297a362
Try to fix black-formatting issues
JeffersonBledsoe Mar 7, 2022
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
118 changes: 87 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: CI
on:
push:
branches-ignore:
- "master"
- "releases/**"

jobs:
Expand All @@ -12,18 +11,52 @@ jobs:
strategy:
fail-fast: false
matrix:
plone-version:
plone-version:
- '5.0'
- '5.1'
- '5.2'
python-version: ['2.7']
include:
- plone-version: 5.2
python-version: ['2.7', '3.6', '3.7', '3.8']
layer:
- Portlet_AjaxDisabled
- Portlet_AjaxEnabled
- Tile
- unit
coverage: ['no_coverage', 'coverage']
exclude:
- plone-version: 5.0
layer: Tile # standardtiles 2.3.2 does support using the request to query. embed might still be possible
- plone-version: 5.0
layer: Portlet_AjaxEnabled # passes but meaningless as it skips all the tests
# Only 5.2+ runs on py3
- plone-version: 5.0
python-version: 3.6
- plone-version: 5.2
- plone-version: 5.0
python-version: 3.7
- plone-version: 5.2
- plone-version: 5.0
python-version: 3.8
- plone-version: 5.1
python-version: 3.6
- plone-version: 5.1
python-version: 3.7
- plone-version: 5.1
python-version: 3.8
# Save some time by not running all the robot tests
- python-version: 3.6
layer: Portlet_AjaxDisabled
- python-version: 3.7
layer: Portlet_AjaxDisabled
- python-version: 3.6
layer: Tile
- python-version: 3.7
layer: Tile
# save some time only running coverage on the 5.2 tests
- plone-version: 5.0
coverage: coverage
- plone-version: 5.1
coverage: coverage
- plone-version: 5.2
coverage: no_coverage

steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -35,24 +68,25 @@ jobs:
sudo apt-get update -y
# sudo apt-get install -y build-essentials
sudo apt-get install -y libxml2-dev libxslt-dev python-dev
# sudo apt-get install py-pip
# sudo apt-get install py-pip
pip install \
virtualenv wheel
- uses: nanasess/setup-chromedriver@master
# with:
# # Optional: do not specify to match Chrome's version
# chromedriver-version: '77.0.3865.40'
# chromedriver-version: '77.0.3865.40'
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: |
~/buildout-cache
~/extends
~/.cache/pip
# key: ${{ runner.os }}-buildout-${{ hashFiles('**/*.cfg') }}-${{ matrix.plone-version }}-${{ matrix.python-version }}
key: ${{ runner.os }}-buildout-${{ matrix.plone-version }}-${{ matrix.python-version }}
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.plone-version }}-${{ hashFiles('**/*.cfg') }}
restore-keys: |
${{ runner.os }}-buildout-
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.plone-version }}-
${{ runner.os }}-${{ matrix.python-version }}-
${{ runner.os }}-
- name: setup buildout cache
run: |
mkdir -p ~/buildout-cache/{eggs,downloads}
Expand All @@ -69,44 +103,66 @@ jobs:
bin/buildout -t 10 -Nc test-${{ matrix.plone-version }}.x.cfg
bin/pip install zest.pocompile
bin/pocompile src
- name: test
- name: test robot
if: ${{ matrix.coverage != 'coverage' && matrix.layer != 'unit' }}
run: |
export DISPLAY=:99.0
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
sleep 3
bin/test --all
bin/test --all --layer ${{ matrix.layer }} --list-tests
bin/test --all --layer ${{ matrix.layer }}
- name: test unit
if: ${{ matrix.coverage != 'coverage' && matrix.layer == 'unit' }}
run: |
bin/test --unit --list-tests
bin/test --unit
- name: createcoverage
if: ${{ matrix.coverage == 'coverage' && matrix.layer != 'unit' }}
run: |
export DISPLAY=:99.0
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
sleep 3
bin/test --all --layer ${{ matrix.layer }} --list-tests
bin/createcoverage -t '--all --layer ${{ matrix.layer }}'
bin/coverage json -i
- name: createcoverage
if: ${{ matrix.coverage == 'coverage' && matrix.layer == 'unit' }}
run: |
bin/test --unit --list-tests
bin/createcoverage -t '--unit'
bin/coverage json -i
- name: Coveralls
if: ${{ matrix.coverage == 'coverage' }}
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: ${{ matrix.plone-version }}-${{ matrix.python-version }}-${{ matrix.layer }}
- name: code-analysis
run: echo "${{ matrix.plone-version }}" | grep 5.1 || bin/code-analysis
if: always()
run: echo "${{ matrix.plone-version }}" | grep 5.1 || bin/code-analysis
- name: black
if: ${{ matrix.python-version == '3.8' }}
run: |
pip install black
black --check src
- name: Artifact Robot Test Report
if: failure()
uses: actions/upload-artifact@v1
with:
name: test_results
name: test_results-${{ matrix.python-version }}-${{ matrix.plone-version }}-${{ matrix.layer }}
path: ./parts/test
- uses: actions/setup-python@v2
if: failure()
with:
python-version: 2.7
python-version: 2.7
- name: Robottest report
continue-on-error: true
if: failure()
run: |
pip2.7 install popt || pip2.7 install --user popt
grep --include=output.xml -Rl FAIL parts/test | xargs --no-run-if-empty -n 1 popt
- name: createcoverage
run: |
export DISPLAY=:99.0
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
sleep 3
bin/createcoverage -t '--all'
# bin/createcoverage
bin/coverage json -i
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: ${{ matrix.plone-version }}-${{ matrix.python-version }}

coveralls_finish:
needs: build
Expand Down
28 changes: 26 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
Changelog
=========

3.6 (unreleased)
4.0 (unreleased)

Breaking Change:

- Add idx parameter to display_modifier call, so that we can use the index name to resolve the correct translated taxonomy titles in collective.taxonomy. This means that the display_modifier method in the groupby_modifier adapters needs to expect this parameter too!
[MrTango]

Bug Fixes:

- Fix edge cases where "All" wasn't translated.
[agitator]

- Ensure a `GroupByCriteria`'s `sort_key_function` function `lower()` call gets a string.
[jensens]

- Fixed searches for only non-alphanumeric characters causing an exception to be displayed.
[JeffersonBledsoe]

Other:

- Code-Style Black and Isort
[jensens]


3.5.1 (2021-05-26)
----------------

- Updated de and ch-de translations
Expand All @@ -11,7 +35,7 @@ Changelog
3.5 (2021-05-26)
----------------

- Use collection from context as default. `target_collection` is now used to select an alternative collection as result source.
- Use collection from context as default. `target_collection` is now used to select an alternative collection as result source.
This allows to copy and paste preconfigured collections for reuse without reconfiguring each filter element.
[agitator]

Expand Down
45 changes: 30 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ collective.collectionfilter
:target: https://github.com/collective/collective.collectionfilter/actions


Faceted navigation filter for collection results.
Faceted navigation filter for collection or contentlisting tiles.

This Plone 5 addon allows you to filter collections results for additional catalog metadata.
This Plone 5 addon allows you to filter listing results for fields which are indexed in the catalog
(Plones internal search tool).
For example, you can add a subject filter, but also a filter for authors or portal types.
This can also be used to build tag clouds.

The filter types can be extended (see: ``collective.collectionfilter.vocabularies``).

Expand All @@ -35,27 +35,42 @@ There are three portlets/tiles available for filtering:
a list of indexes where the user can sort the filtered result listing


Filter Results with portlets
Filter Results of Collections
----------------------------

Add as many of the filter portlets above to any context you want (most likely the source collection)
and assign a collection with results to it.
Add as many filter/search portlets directly to a collection.

When you select values from the filter the results are loaded asynchronously inside the container
with the selector defined in the field ``Content Selector``. Make sure the selector exists on the
source collection template and on the target page which shows the filtered results.
When you select values from the filter the results are loaded asynchronously onto the page (no page refresh).
Unless you turn off ajax loading in the registery or are using Plone 5.0. If you are using special theme or view template
you can customize ``Content Selector`` and/or ```View Template``` to ensure ajax loading works correctly.
Make sure the selector exists on the source collection template and on the target page which shows the filtered results.

It is also possible to use filter portlets that aren't directly on a collection by specifying a target collection.
To use ajax loading you will need to ensure your content selector is visible on the page. If not using ajax loading selecting a filter
option will redirect you to the collection.


Mosaic Integration
------------------

Use the package extra to install the required dependencies::

[buildout]
...
eggs +=
collective.collectionfilter[mosaic]
...

The three tiles can be added within the Mosaic editor multiple times. Just select them in the ``Insert`` menu
and assign a collection to it. To show the results of the collection simply add a
``Existing Content`` tile which links to the same collection your filter tiles are assigned with.
``Content Listing`` tile.

It's possible to use multiple content listings and multiple filters on the same page by specifying additional unique classes in
the listing tiles settings and then adding these classes to the ``Content Selector`` setting of the filter tile.

If you want to use filter tiles with a collection then add a content listing tile with the setting to use the query from the context.
It is also possible to use the ``Embed content`` tile if there is a unique selector on your collection view.

TODO: right now the collection needs a default_view template, which wraps the result list with a unique selector
inside the ``#content-core`` container. so the collectionfilter can load the filtered result correctly from
the collection into the container inside the existing content tile.


Geolocation filter support
Expand Down Expand Up @@ -129,12 +144,12 @@ Write an adapter::
@implementer(IGroupByModifier)
@adapter(IGroupByCriteria)
def groupby_modifier(groupby):
groupby._groupby['Subject']['display_modifier'] = lambda x: x.upper()
groupby._groupby['Subject']['display_modifier'] = lambda x, idx: x.upper()
groupby._groupby['Subject']['sort_key_function'] = subjectsort
groupby._groupby['my_new_index'] = {
'index': 'my_new_index',
'metadata': 'my_new_index_metadata_colum',
'display_modifier': lambda it: u'this is awesome: {0}'.format(it)
'display_modifier': lambda it, idx: u'this is awesome: {0}'.format(it)
}

Register the adapter::
Expand Down
33 changes: 30 additions & 3 deletions base.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
[buildout]
extensions = mr.developer
# extensions = mr.developer
versions = versions

[code-analysis]
directory = ${buildout:directory}/src/collective/collectionfilter
flake8-ignore = E501,E241,W503

[versions]
collective.collectionfilter =
collective.geolocationbehavior = >=1.6.0
plone.formwidget.geolocation = >=2.2.0
plone.patternslib = >=1.1.0
plone.app.standardtiles = >= 2.4.0
plone.batching = >=1.1.7

# plone.app.standardtiles = 2.3.1 # fix https://github.com/plone/plone.app.standardtiles/issues/111
pycodestyle =

# Robot Testing (see buildout.coredev[5.2]/versions.cfg)
plone.app.robotframework = 1.5.4
Expand All @@ -22,5 +29,25 @@ robotframework-selenium2screenshots = 0.8.1
robotsuite = 2.2.1
selenium = 3.141.0

[code-analysis]
directory= ${buildout:directory}/src/collective/collectionfilter
[versions:python27]
# to get codeanalysis working
build = 0.1
coverage = 5.5

# Required by:
# build==0.1.0
packaging = 20.8
contextlib2 = 0.6.0.post1

# Required by:
# build==0.1.0
typing = 3.7.4.3


flake8 = 3.9.2
configparser = <5.0.0

flake8-pep3101 = 0.6
flake8-commas = 0.1.6
flake8-isort = 1.3
flake8-deprecated = 1.0
4 changes: 4 additions & 0 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ eggs =
scripts =
plone-compile-resources
# zopepy


[instance]
eggs+= plone.staticresources
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def read(*rnames):
"plone.app.contenttypes",
],
extras_require={
"mosaic": [
"plone.app.mosaic >= 2.2.3",
"plone.app.standardtiles >= 2.4.0",
],
"geolocation": [
# support for latitude/longitude catalog index
"collective.geolocationbehavior >= 1.6.0",
Expand Down
Loading