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

"Folder" option filter portlet/tile #136

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft

"Folder" option filter portlet/tile #136

wants to merge 30 commits into from

Conversation

djay
Copy link
Member

@djay djay commented Jul 12, 2021

How it works

The idea is to support documents that are already organised by folders with useful names and where heretical organisation might be needed.

  1. Create a normal filter portlet
  2. Select "Folder" as the groupby
  3. Pick if you want dropdown, links or checkboxes/radio etc
  4. Will display the top level folders with counts inside each based on other other filters already applied. Won't display folders with no content in the results
  5. Will "open" a folder if selected. This will show counts for subfolders at this new level similar to the the top level (it only shows folders). Indenting is used to show the folder hierarchy.
  6. if a folder is opened (ie selected) then this will narrow down other filters
  7. You can "open" multiple folders at once if enabled

Changes

I took the code from #26 and replaced the new section filter with an option in the existing filter portlet. It mostly does this by using new groupby_criteria defaults

Pros

  • can select multiple paths using checkboxes or links
  • same modifiers can be used to achieve the same result for anything path like e.g. multi-level taxonomy
  • less code
  • less clutter in the UI of having another portlet type

Cons

  • Won't appear exactly like a navigation portlet
    • but I think it doesn't behave exactly like a navigation portlet so maybe this is a pro?

Changes to groupby_criteria

Introduced the following changes to groupby_criteria overrides

  • groupby_modifier.
    • Lets you turn single metadata value one or more other values. Also allows removing certain values so could replace value_blacklist.
    • For Folders it allows a leaf to include all its parents as options.
    • It ensures the order that options are added is preserved
  • "groupby_name" which allows integrators to override the name of an index/grouby_criteria
  • sort_on - allows query used to determine options to be sorted so options are sorted using the index rather than a function.
    • this didn't end up being used for Folders so can be removed if desired

Indenting

Alternatives

  • support level/nesting directly via a level_modifier
    • Any widget used will then have to choose how best to display this
    • could be useful for taxonomies that also need to display multiple levels/nesting?
  • have widgets be paths and then widgets know to display these nested
    • e.g. "My Folder / My sub" will get turned into "{indent}My Sub" by the templates/widgets
  • Support customisable widgets/templates (later)
    • ie modifier can specify new template for a given index which cab better display that index, e.g. tree control

"Folder" as criteria name

When you pick the groupby it's called "Folder"

Pros

  • it's a terms used in plone elsewhere and should be obvious what it means. Path is more a technical term.
  • It only displays folders, never full paths.
    Cons
  • in collections its called "Location"

Alternatives

  • Section
  • Path
  • Location
  • use translation to pick english name instead of groupby_criteria

@djay djay changed the title path filter in filter path/section grouby in filter portlet Jul 12, 2021
@djay djay changed the title path/section grouby in filter portlet path/section groupby in filter portlet Jul 12, 2021
@djay djay marked this pull request as draft July 12, 2021 09:50
@djay djay requested a review from petschki July 12, 2021 09:50
@djay djay changed the base branch from master to collectionish July 12, 2021 10:08
@djay djay requested a review from agitator July 19, 2021 09:28
@djay
Copy link
Member Author

djay commented Jul 19, 2021

@agitator any answers to the questions above?

Base automatically changed from collectionish to master July 19, 2021 11:46
@djay
Copy link
Member Author

djay commented Jul 26, 2021

@petschki I've cleaned it all up and finalised the things I wasn't sure on. It's ready for a review.
The only thing I haven't done is fix the css and compile it.

@djay djay marked this pull request as ready for review July 27, 2021 09:48
@djay djay changed the base branch from master to 5.2-test-build-fix November 16, 2021 10:09
Base automatically changed from 5.2-test-build-fix to master November 17, 2021 03:14
@djay djay changed the title path/section groupby in filter portlet "Folder" option filter portlet/tile Nov 17, 2021
@djay djay mentioned this pull request Nov 17, 2021
3 tasks
@djay djay marked this pull request as draft May 5, 2022 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant