ckanext-d4science_theme/ckanext/d4science_theme/templates/home/snippets/stats.html

44 lines
1.6 KiB
HTML

{% set stats = h.get_site_statistics() %}
{% set systemtypefacet = h.d4science_theme_get_systemtype_field_dict_from_session() %}
{% set count_systemtypefacet = h.d4science_theme_count_facet_items_dict(systemtypefacet['name']) %}
<div class="box stats">
<div class="inner">
<h3>{{ _('{0} statistics').format(g.site_title) }}</h3>
<ul>
{% block stats_group %}
<li>
<a href="{{ h.url_for(controller='package', action='search') }}">
<b>{{ h.SI_number_span(stats.dataset_count) }}</b>
{{ _('dataset') if stats.dataset_count == 1 else _('datasets') }}
</a>
</li>
{% if stats.organization_count > 0 %}
<li>
<a href="{{ h.url_for(controller='organization', action='index') }}">
<b>{{ h.SI_number_span(stats.organization_count) }}</b>
{{ _('organization') if stats.organization_count == 1 else _('organizations') }}
</a>
</li>
{% endif %}
{% if stats.group_count > 0 %}
<li>
<a href="{{ h.url_for(controller='group', action='index') }}">
<b>{{ h.SI_number_span(stats.group_count) }}</b>
{{ _('group') if stats.group_count == 1 else _('groups') }}
</a>
</li>
{% endif %}
{% if count_systemtypefacet > 0 %}
<li>
<a href="{{ h.url_for(controller='d4STypeController', action='index') }}">
<b>{{ h.SI_number_span(count_systemtypefacet) }}</b>
{{ _(systemtypefacet['title']) if count_systemtypefacet <= 1 else _(systemtypefacet['title'])+'s' }}
</a>
</li>
{% endif %}
{% endblock %}
</ul>
</div>
</div>