{% extends "page.html" %}

{% block subtitle %}{{ h.humanize_entity_type('organization', group_type, 'page title') or _('Organizations') }}{% endblock %}

{% block breadcrumb_content %}
  <li class="active">{% link_for h.humanize_entity_type('organization', group_type, 'breadcrumb') or _('Organizations'), named_route=group_type+'.index' %}</li>
{% endblock %}

{% block page_header %}{% endblock %}

{% block page_primary_action %}
  {% if h.check_access('organization_create') %}
    {% link_for h.humanize_entity_type('organization', group_type, 'add link') or _('Add Organization'), named_route=group_type ~ '.new', class_='btn btn-primary', icon='plus-square' %}
  {% endif %}
{% endblock %}

{% block primary_content_inner %}
  <h1 class="hide-heading">{% block page_heading %}{{ h.humanize_entity_type('organization', group_type, 'page title') or _('Organizations') }}{% endblock %}</h1>
  {% block organizations_search_form %}
    {% snippet 'snippets/search_form.html', form_id='organization-search-form', type=group_type, query=q, sorting_selected=sort_by_selected, count=page.item_count, placeholder=h.humanize_entity_type('organization', group_type, 'search placeholder') or _('Search organizations...'), show_empty=request.params, no_bottom_border=true if page.items, sorting = [(_('Name Ascending'), 'title asc'), (_('Name Descending'), 'title desc')] %}
  {% endblock %}
  {% block organizations_list %}
    {% if page.items or request.params %}
      {% if page.items %}
        {% snippet "organization/snippets/organization_list.html", organizations=page.items %}
      {% endif %}
    {% else %}
      <p class="empty">
        {{ _('There are currently no organizations for this site') }}.
        {% if h.check_access('organization_create') %}
          {% link_for _('How about creating one?'), named_route=group_type+'.new' %}</a>.
        {% endif %}
      </p>
    {% endif %}
  {% endblock %}
  {% block page_pagination %}
    {{ page.pager(q=q or '', sort=sort_by_selected or '') }}
  {% endblock %}
{% endblock %}

{% block secondary_content %}
  {% snippet "organization/snippets/helper.html", group_type=group_type %}
{% endblock %}
