{#
  Embeds a organization within the sidebar of a page.

  organization    - The organization dict.
  has_context_title - Boolean for whether to display a module-heading for when
  this snippet appears within a non-organization template
  (e.g. dataset page sidebar)

  Example:

  {% snippet 'snippets/organization, organization=c.group_dict %}

  #}

{% set url = h.url_for(organization.type + '.read', id=organization.name, ) %}
{% set dataset_type = h.default_package_type() %}

{% block info %}
  <div class="module module-narrow module-shallow context-info">
    {% if has_context_title %}
      <h2 class="module-heading"><i class="fa fa-building"></i> {{ h.humanize_entity_type('organization', organization.type, 'sidebar label') or _('Organization') }}</h2>
    {% endif %}
    <section class="module-content">
      {% block inner %}
      {% block image %}
        <div class="image">
          <a href="{{ url }}">
            <img src="{{ organization.image_display_url or h.url_for_static('/base/images/placeholder-organization.png') }}" width="200" alt="{{ organization.name }}" />
          </a>
        </div>
      {% endblock %}
      {% block heading %}
      <h1 class="heading">{{ organization.title or organization.name }}
        {% if organization.state == 'deleted' %}
          [{{ _('Deleted') }}]
        {% endif %}
      </h1>
      {% endblock %}
      {% block description %}
      {% if organization.description %}
        <p class="description">
          {{ h.markdown_extract(organization.description, 180) }}
        </p>
        <p class="read-more">
          {% link_for _('read more'), named_route=organization.type ~ '.about', id=organization.name %}
        </p>
      {% else %}
        <p class="empty">{{ h.humanize_entity_type('organization', organization.type, 'no description') or _('There is no description for this organization') }}</p>
      {% endif %}
      {% endblock %}
      {% if show_nums %}
        {% block nums %}
        <div class="nums">
          <dl>
            <dt>{{ _('Followers') }}</dt>
            <dd data-module="followers-counter" data-module-id="{{ organization.id }}" data-module-num_followers="{{ organization.num_followers }}">{{ h.SI_number_span(organization.num_followers) }}</dd>
          </dl>
          <dl>
            <dt>{{ h.humanize_entity_type('package', dataset_type, 'facet label') or _('Datasets') }}</dt>
            <dd>{{ h.SI_number_span(organization.package_count) }}</dd>
          </dl>
        </div>
        {% endblock %}
        {% block follow %}
        <div class="follow_button">
          {{ h.follow_button('group', organization.id) }}
        </div>
        {% endblock %}
      {% endif %}
      {% endblock %}
    </section>
  </div>
  {% endblock %}
