{% extends "page.html" %}

{% block subtitle %}{{ c.group_dict.display_name }}{% endblock %}

{% block breadcrumb_content %}
  <li>{% link_for _('Groups'), controller='group', action='index' %}</li>
  <li class="active">{% link_for c.group_dict.display_name|truncate(35), controller='group', action='read', id=c.group_dict.name %}</li>
{% endblock %}

{% block actions_content %}
  {% if h.check_access('group_update', {'id': c.group_dict.id}) %}
    <li>{% link_for _('Add Dataset'), controller='package', action='new', group=c.group_dict.id, class_='btn', icon='plus-sign-alt' %}</li>
    <li>{% link_for _('Edit'), controller='group', action='edit', id=c.group_dict.name, class_='btn btn-primary', icon='wrench' %}</li>
  {% endif %}
  <li>{{ h.follow_button('group', c.group_dict.id) }}</li>
{% endblock %}

{% block primary_content %}
  <section class="module">
    {% block page_header %}
      <header class="module-content page-header">
        <ul class="nav nav-tabs">
          {% block page_header_tabs %}
            {{ h.build_nav_icon('group_read', _('Datasets'), id=c.group_dict.name) }}
            {{ h.build_nav_icon('group_activity', _('Activity Stream'), id=c.group_dict.name, offset=0) }}
            {{ h.build_nav_icon('group_about', _('About'), id=c.group_dict.name) }}
          {% endblock %}
        </ul>
      </header>
    {% endblock %}
    {% block primary_content_inner %}{% endblock %}
  </section>
{% endblock %}

{% block secondary_content %}
  <div class="module context-info">
    <section class="module-content">
      <div class="image">
        <a href="{{ c.group_dict.url }}">
          <img src="{{ c.group_dict.image_url or h.url_for_static('/base/images/placeholder-group.png') }}" width="190" height="118" alt="{{ c.group_dict.name }}" />
        </a>
      </div>
      <h1 class="heading">{{ c.group_dict.display_name }}</h1>
      {% if c.group_dict.description %}
        <p>
          {{ h.markdown_extract(c.group_dict.description, 180) }}
          {% link_for _('read more'), controller='group', action='about', id=c.group_dict.name %}
        </p>
      {% else %}
        <p class="empty">{{ _('There is no description for this group') }}</p>
      {% endif %}
      <div class="nums">
        <dl>
          <dt>{{ _('Followers') }}</dt>
          <dd>{{ h.SI_number_span(c.group_dict.num_followers) }}</dd>
        </dl>
        <dl>
          <dt>{{ _('Datasets') }}</dt>
          <dd>{{ h.SI_number_span(c.group_dict.packages|length) }}</dd>
        </dl>
      </div>
    </section>
  </div>
{% endblock %}

{% block links %}
  {{ super() }}
  {% include "group/snippets/feeds.html" %}
{% endblock %}
