Skip to content

Commit

Permalink
[#2375] Deprecate facet_title helper function.
Browse files Browse the repository at this point in the history
In favour of get_facet_title, which has improved i18n support.
  • Loading branch information
icmurray committed Sep 13, 2012
1 parent c3d7a9a commit c2b604e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ckan/lib/helpers.py
Expand Up @@ -521,6 +521,7 @@ def unselected_facet_items(facet, limit=10):
'''
return get_facet_items_dict(facet, limit=limit, exclude_active=True)

@deprecated('Please use get_facet_title(name) for i18n improvements.')
def facet_title(name):
# FIXME this looks like an i18n issue
return config.get('search.facets.%s.title' % name, name.capitalize())
Expand Down Expand Up @@ -1311,7 +1312,7 @@ def format_resource_items(items):
'subnav_link',
'subnav_named_route',
'default_group_type',
'facet_title',
# 'facet_title', # deprecated
# am_authorized, # deprecated
'check_access',
'linked_user',
Expand Down
4 changes: 2 additions & 2 deletions ckan/templates_legacy/facets.html
Expand Up @@ -32,7 +32,7 @@
-->
<py:def function="facet_div(name, title, limit=10, label_function=lambda item: item.display_name, if_empty=None, count_label=lambda c: ' (%d)'%c)">
<div py:if="if_empty is not None or h.unselected_facet_items(name, limit)" class="facet-box">
<h2>${h.facet_title(title)}</h2>
<h2>${h.get_facet_title(title)}</h2>
<ul class="facet-options">
${facet_li(name, limit=limit, label_function=label_function, if_empty=None, count_label=count_label)}
</ul>
Expand Down Expand Up @@ -78,7 +78,7 @@ <h2>${h.facet_title(title)}</h2>
<py:def function="field_list()">
<div class="filter-list" py:if="c.fields">
<div class="filter-entry" py:for="(field, value) in c.fields">
<span class="name">${h.facet_title(field)}</span>
<span class="name">${h.get_facet_title(field)}</span>
<span class="value" py:choose="">
<py:when test="c.translated_fields and c.translated_fields.has_key((field,value))">
${c.translated_fields[(field,value)]}
Expand Down

0 comments on commit c2b604e

Please sign in to comment.