{#
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 h.url_for_static('/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>
