Skip to content

Commit

Permalink
fix: apply index modifier when creating values for view
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmassmann committed Apr 19, 2023
1 parent 37ea0d6 commit 57ea7a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/collective/collectionfilter/baseviews.py
Expand Up @@ -99,7 +99,7 @@ def pat_options(self):
"reloadURL": self.reload_url,
"ajaxLoad": self.ajax_load,
"contentSelector": self.content_selector,
"notifyOnly": self.notify_only
"notifyOnly": getattr(self, "notify_only", False)
}
)

Expand Down
8 changes: 7 additions & 1 deletion src/collective/collectionfilter/filteritems.py
Expand Up @@ -159,7 +159,13 @@ def get_filter_items(
# Get index in question and the current filter value of this index, if set.
groupby_criteria = getUtility(IGroupByCriteria).groupby
idx = groupby_criteria[group_by]["index"]
current_idx_value = safe_iterable(request_params.get(idx))

# Added: use index modifier, if available
# This fixes e.g. boolean indices which couldn’t show the current value as selected
idx_mod = groupby_criteria[group_by]["index_modifier"]
crit = request_params.get(idx)
crit = idx_mod(crit) if idx_mod else safe_decode(crit)
current_idx_value = safe_iterable(crit)

# Additive filtering is about adding other filter values of the same index.
extra_ignores = [] if narrow_down else [idx, idx + "_operator"]
Expand Down

0 comments on commit 57ea7a8

Please sign in to comment.