diff --git a/ckan/templates/snippets/facet_list.html b/ckan/templates/snippets/facet_list.html index 3a189237d91..1d132d5f9d3 100644 --- a/ckan/templates/snippets/facet_list.html +++ b/ckan/templates/snippets/facet_list.html @@ -29,45 +29,51 @@ URL to use when building the necessary URLs, instead of the default ones returned by url_for. Useful eg for dataset types. +hide_empty + Do not show facet if there are none, Default: false. + #} +{% set hide_empty = hide_empty or false %} {% with items = items or h.get_facet_items_dict(name) %} - {% if within_tertiary %} - {% set nav_class = 'nav nav-pills nav-stacked' %} - {% set nav_item_class = ' ' %} - {% set wrapper_class = 'nav-facet nav-facet-tertiary' %} - {% endif %} -
-

- - {% set title = title or h.get_facet_title(name) %} - {{ title }} - {{ _('Clear All') }} -

- {% if items %} - - - {% else %} -

{{ _('There are no {facet_type} that match this search').format(facet_type=title) }}

+ {% if items or not hide_empty %} + {% if within_tertiary %} + {% set nav_class = 'nav nav-pills nav-stacked' %} + {% set nav_item_class = ' ' %} + {% set wrapper_class = 'nav-facet nav-facet-tertiary' %} {% endif %} -
+
+

+ + {% set title = title or h.get_facet_title(name) %} + {{ title }} + {{ _('Clear All') }} +

+ {% if items %} + + + {% else %} +

{{ _('There are no {facet_type} that match this search').format(facet_type=title) }}

+ {% endif %} +
+ {% endif %} {% endwith %}