Skip to content

Commit

Permalink
[#3022] Use alternative_url on facet_list when genereating URLs
Browse files Browse the repository at this point in the history
This allows dataset type pages to show their own facets and have links
pointing to the right direction.
  • Loading branch information
amercader committed Dec 19, 2012
1 parent 0d95e4a commit c26b7b8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ckan/templates/snippets/facet_list.html
Expand Up @@ -25,13 +25,18 @@
extras
Extra info passed into the add/remove params to make the url

alternative_url
URL to use when building the necessary URLs, instead of the default
ones returned by url_for. Useful eg for dataset types.


#}
{% with items = items or h.get_facet_items_dict(name) %}
<section class="module module-narrow module-shallow">
<h2 class="module-heading">
<i class="icon-medium icon-filter"></i>
{{ title or h.get_facet_title(name) }}
<a href="{{ h.remove_url_param(name, extras=extras) }}" class="action">{{ _('Clear All') }}</a>
<a href="{{ h.remove_url_param(name, extras=extras, alternative_url=alternative_url) }}" class="action">{{ _('Clear All') }}</a>
</h2>
{% if items %}
<nav>
Expand All @@ -50,9 +55,9 @@ <h2 class="module-heading">
</nav>
<p class="module-footer">
{% if h.get_param_int('_%s_limit' % name) %}
<a href="{{ h.remove_url_param('_%s_limit' % name, replace=0, extras=extras) }}" class="read-more">{{ _('Show More {facet}').format(facet=h.get_facet_title(name)) }}</a>
<a href="{{ h.remove_url_param('_%s_limit' % name, replace=0, extras=extras, alternative_url=alternative_url) }}" class="read-more">{{ _('Show More {facet}').format(facet=h.get_facet_title(name)) }}</a>
{% else %}
<a href="{{ h.remove_url_param('_%s_limit' % name, extras=extras) }}" class="read-more">{{ _('Show Only Popular {facet}').format(facet=h.get_facet_title(name)) }}</a>
<a href="{{ h.remove_url_param('_%s_limit' % name, extras=extras, alternative_url=alternative_url) }}" class="read-more">{{ _('Show Only Popular {facet}').format(facet=h.get_facet_title(name)) }}</a>
{% endif %}
</p>
{% else %}
Expand Down

0 comments on commit c26b7b8

Please sign in to comment.