-
Notifications
You must be signed in to change notification settings - Fork 2k
/
group_item.html
38 lines (35 loc) · 1.49 KB
/
group_item.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{#
Renders a media item for a group. This should be used in a list.
group - A group dict.
first - Pass true if this is the first item in a row.
last - Pass true if this is the last item in a row.
Example:
<ul class="media-grid">
{% for group in groups %}
{% set first = loop.index0 % 3 == 0 %}
{% set last = loop.index0 % 3 == 2 %}
{% snippet "group/snippets/group_item.html", group=group, first=first, last=last %}
{% endfor %}
</ul>
#}
{% set url = h.url_for(group.type ~ '_read', action='read', id=group.name) %}
<li class="media-item media media-vertical{% if first %} first{% endif %}{% if last %} last{% endif %}">
<a class="media-image" href="{{ url }}"><img src="{{ group.image_url or '/base/images/placeholder-group.png' }}" alt="{{ group.name }}" /></a>
<div class="media-content">
<h3 class="media-heading">
<a href="{{ url }}" title="{{ _('View {name}').format(name=group.display_name) }}">
{{ group.display_name }}
</a>
</h3>
{% if group.description %}
<p>{{ h.truncate(group.description, length=80, whole_word=True) }}</p>
{% else %}
<p class="empty">{{ _('This group has no description') }}</p>
{% endif %}
{% if group.packages %}
<a class="btn btn-small btn-primary" href="{{ url }}">{{ ungettext('{num} Dataset', '{num} Datasets', group.packages).format(num=group.packages) }}</a>
{% else %}
<span class="btn btn-small disabled">{{ _('0 Datasets') }}</span>
{% endif %}
</div>
</li>