Select Git revision
main.scss
facet_list.html 2.68 KiB
{% ckan_extends %}
{% block facet_list_heading %}
{# {% set title = title or h.get_facet_title(name) %}
{{ title }} #}
{% endblock %}
{% block facet_list_items %}
{# {% with items = items or h.get_facet_items_dict(name,20) %} #}
{% with items = items or h.odsh_get_facet_items_dict(name,20) %}
{% if items %}
<nav>
{% set title = title or h.get_facet_title(name) %}
<div class="nav-title">{{ title }}</div>
<ul class="{{ nav_class or 'unstyled nav nav-simple nav-facet' }}">
{% for item in items %}
{% set href = h.remove_url_param(name, item.name, extras=extras, alternative_url=alternative_url) if
item.active else h.add_url_param(new_params={name: item.name}, extras=extras, alternative_url=alternative_url)
%}
{% set label = label_function(item) if label_function else item.display_name %}
{% set count = count_label(item['count']) if count_label else ('%d' % item['count']) %}
{% set digits = max([label|string|length,2)] %}
{% set label_truncated = h.truncate(label, 29-digits) if not label_function else label %}
<li class="{{ nav_item_class or 'nav-item' }}">
<div class="facet_label">
{# TODO: checkbox-id vereinheitlichen (code-duplikation) und sicher gegen Titel mit Leerzeichen machen! #}
<input type="checkbox" {% if item.active %} checked {% endif %} class="filter-checkbox" id="check-{{ title.lower() }}-{{ loop.index }}"/>
<label class="mylabel" for="check-{{ title.lower() }}-{{ loop.index }}"></label>
<a href="{{ href }}" title="{{ label if label != label_truncated else '' }}">
<span>{{ label_truncated }}</span>
</a>
</div>
<div class="facet_count">
<span class="facet_count">{{ count }}</span>
</div>
</li>
{% endfor %}
</ul>
</nav>
{# TODO: when there are more than N facets ('with items...' above), how many should be
displayed and how should these links look? Pascal R. 12.10.2018 #}
{#<p class="module-footer">
{% if h.get_param_int('_%s_limit' % name) %}
{% if h.has_more_facets(name) %}
<a href="{{ h.remove_url_param('_%s_limit' % name, replace=0, extras=extras, alternative_url=alternative_url) }}"
class="read-more">{{ _('Show More {facet_type}').format(facet_type=title) }}</a>
{% endif %}
{% else %}
<a href="{{ h.remove_url_param('_%s_limit' % name, extras=extras, alternative_url=alternative_url) }}" class="read-more">{{
_('Show Only Popular {facet_type}').format(facet_type=title) }}</a>
{% endif %}
</p>#}
{% else %}
<p class="module-content empty">{{ _('There are no {facet_type} that match this search').format(facet_type=title) }}</p>
{% endif %}
{% endwith %}
{% endblock %}