{% set dataset_type = h.default_package_type() %}

{% block info %}
<section id="group-info" class="module module-narrow">
  <div class="module context-info">
    <div class="module-content">
    {% block inner %}
    {% block image %}
    <div class="image">
      <a href="{{ group.url }}">
        <img src="{{ group.image_display_url or h.url_for_static('/base/images/placeholder-group.png') }}" width="190" height="118" alt="{{ group.name }}" />
      </a>
    </div>
    {% endblock %}
    {% block heading %}
    <h1 class="heading">
      {{ group.display_name }}
      {% if group.state == 'deleted' %}
        [{{ _('Deleted') }}]
      {% endif %}
    </h1>
    {% endblock %}
    {% block description %}
    {% if group.description %}
      <p class="description">
        {{ h.markdown_extract(group.description, 180) }}
      </p>
      <p class="read-more">
        {% link_for _('read more'), named_route='group.about', id=group.name %}
      </p>
    {% endif %}
    {% endblock %}
    {% if show_nums %}
      {% block nums %}
      {% set num_followers = h.follow_count('group', group.id) %}
      <div class="nums">
        <dl>
          <dt>{{ _('Followers') }}</dt>
          <dd>{{ h.SI_number_span(num_followers) }}</dd>
        </dl>
        <dl>
          <dt>{{ h.humanize_entity_type('package', dataset_type, 'facet label') or _('Datasets') }}</dt>
          <dd>{{ h.SI_number_span(group.package_count) }}</dd>
        </dl>
        <dl>
          <dt>{{ _('Members') }}</dt>
          <dd>{{ h.member_count(group.id) }}</dd>
        </dl>
      </div>
      {% endblock %}
      {% block follow %}
        {% if current_user.is_authenticated %}
          {% if error_message %}
            <div class="alert alert-danger">{{ error_message }}</div>
          {% endif %}
          {% snippet 'snippets/follow_button.html', am_following=am_following, obj_type='group', obj_id=group.id %}
        {% endif %}
      {% endblock %}
    {% endif %}
    {% endblock %}
    </div>
  </div>
</section>
{% endblock %}
