Skip to content

Commit

Permalink
[#2313] Removed deprecated facet_sidebar() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Murray committed Jul 7, 2012
1 parent 9063f7b commit 04a9fd7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 56 deletions.
54 changes: 0 additions & 54 deletions ckan/templates/facets.html
Expand Up @@ -75,60 +75,6 @@ <h2>${h.facet_title(title)}</h2>
</li>
</py:def>

<!--!
DEPRECATED. Provided only for backward compatibility with existing plugins.
Use `facet_div` instead.
Similar to the above, `facet_div` function; this helper creates a <div>
populated with links to filtered search results.
Differences with the preferred `facet_div` function:
* `title` argument is a callable
* `label` is a callable that accepts a string cf. `label_function` which is
a callable that accepts a `facet_item`.
code
The field name identifying the facet field, eg. "tags"
title
A callable used to render the title for the facet. The callable must accept
one string argument, the `code` argument passed in above. Obviously, this
is a bit redundant.
label
Renders the human-readable label for each facet value.
If defined, this should be a callable that accepts a facet_item's name as a
string.
if_empty
A string, which if defined, and the list of possible facet items is empty,
is displayed in lieu of an empty list.
count_label
A callable which accepts an integer, and returns a string. This controls
how a facet-item's count is displayed.
-->
<py:def function="facet_sidebar(code, limit=5, label=lambda n: n, title=h.facet_title, if_empty=None, count_label=lambda c: ' (%d)'%c)">
<?python
import logging
logging.getLogger('ckan.templates.facets').warning("Deprecated function: ckan/templates/facets.html:facet_sidebar()")
?>
<div py:if="if_empty is not None or h.unselected_facet_items(code, limit)" class="facet-box">
<h2>${title(code)}</h2>
<ul class="facet-options">
<li py:for="facet_item in h.unselected_facet_items(code, limit)"
py:if="not (code, facet_item.name) in c.fields">
<a href="${c.drill_down_url(**{code: facet_item.name})}">
<span py:if="'format' in code.lower()">${h.icon(h.format_icon(facet_item.name))}</span>
${label(facet_item.name)}</a>${count_label(facet_item['count'])}
</li>
</ul>
<p py:if="not h.unselected_facet_items(code, limit)">${if_empty}</p>
</div>
</py:def>

<!--!
DEPRECATED. Provided only for backward compatibility with existing plugins.
Use `facet_li` instead.
Expand Down
4 changes: 2 additions & 2 deletions ckanext/publisher_form/templates/publisher_read.html
Expand Up @@ -30,8 +30,8 @@ <h3>Administrators</h3>
</py:if>
</ul>
</li>
${facet_sidebar('tags')}
${facet_sidebar('res_format')}
${facet_div('tags', _('Tags'))}
${facet_div('res_format', _('Resource Formats'))}
</py:match>

<py:match path="content">
Expand Down

0 comments on commit 04a9fd7

Please sign in to comment.