Skip to content

Commit

Permalink
Merge branch 'master' into instification/location_filter
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGES.rst
  • Loading branch information
instification committed Nov 27, 2019
2 parents eff3e69 + 627b235 commit 104543b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ Changelog
3.3 (unreleased)
----------------

- Fix is_available property
[agitator]
- Added css_modifier to extend css class of a filter item
[agitator]
- Fix check for boolean values.
[tmassman]
- fix translation of ``filter_value``
[petschki]
- Add Section Filter portlet. Allows to filter results based on location in site.
[instification, JeffersonBledsoe]

Expand Down
9 changes: 4 additions & 5 deletions src/collective/collectionfilter/baseviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def settings(self):
def available(self):
return True

@property
def is_available(self):
return True

@property
def filter_id(self):
raise NotImplementedError
Expand Down Expand Up @@ -222,11 +226,6 @@ def ajax_url(self):
] if it])
return ajax_url

@property
def is_available(self):
return True


if HAS_GEOLOCATION:

class BaseMapsView(BaseView):
Expand Down
2 changes: 1 addition & 1 deletion src/collective/collectionfilter/filteritems.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def get_filter_items(
# e.g. uuid to title
title = filter_value
if filter_value is not EMPTY_MARKER and callable(display_modifier):
title = _(safe_decode(display_modifier(filter_value)))
title = safe_decode(display_modifier(filter_value))

# Build filter url query
_urlquery = urlquery.copy()
Expand Down
6 changes: 5 additions & 1 deletion src/collective/collectionfilter/vocabularies.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
LIST_SCALING = ['No Scaling', 'Linear', 'Logarithmic']


def translate_value(value):
return translate(_(value), context=getRequest())


def make_bool(value):
"""Transform into a boolean value."""
truthy = [
Expand Down Expand Up @@ -118,7 +122,7 @@ def groupby(self):

for it in metadata:
index_modifier = None
display_modifier = _ # Allow to translate in this package domain per default. # noqa
display_modifier = translate_value # Allow to translate in this package domain per default. # noqa
idx = cat._catalog.indexes.get(it)
if six.PY2 and getattr(idx, 'meta_type', None) == 'KeywordIndex':
# in Py2 KeywordIndex accepts only utf-8 encoded values.
Expand Down

0 comments on commit 104543b

Please sign in to comment.