{% extends "base.html" %}

{%- block page -%}

  {% block skip %}
    <div class="visually-hidden-focusable"><a href="#content">{{ _('Skip to main content') }}</a></div>
  {% endblock %}

  {#
  Override the header on a page by page basis by extending this block. If
  making sitewide header changes it is preferable to override the header.html
  file.
  #}
  {%- block header %}
    {% include "header.html" %}
  {% endblock -%}

  {# The content block allows you to replace the content of the page if needed #}
  {%- block content %}
    {% block maintag %}<div class="main">{% endblock %}
      <div id="content" class="container">
        {% block main_content %}
          {% block flash %}
            <div class="flash-messages">
              {% block flash_inner %}
                {% for category, message in h.get_flashed_messages(with_categories=true) %}
                  <div class="alert alert-dismissible fade show {{ category }}" role="alert">
                    {{ h.literal(message) }}
                  </div>
                {% endfor %}
              {% endblock %}
            </div>
          {% endblock %}

          {% block toolbar %}
            <div class="toolbar" role="navigation" aria-label="{{ _('Breadcrumb') }}">
              {% block breadcrumb %}
                {% if self.breadcrumb_content() | trim %}
                  <ol class="breadcrumb">
                    {% snippet 'snippets/home_breadcrumb_item.html' %}
                    {% block breadcrumb_content %}{% endblock %}
                  </ol>
                {% endif %}
              {% endblock %}
            </div>
          {% endblock %}

          <div class="row {% block wrapper_class %}{% endblock %}{% if self.secondary()|trim == '' or c.action=='resource_read' %} no-nav{% endif %}">
            {#
            The pre_primary block can be used to add content to before the
            rendering of the main content columns of the page.
            #}
            {% block pre_primary %}
              {% if self.content_action() | trim %}
                <div class="content_action gap-1 mb-md-3">
                  {% block content_action %}{% endblock %}
                </div>
              {% endif %}
            {% endblock %}

            {% block secondary %}
              <aside class="secondary col-md-4 col-lg-3">
                {#
                The secondary_content block can be used to add content to the
                sidebar of the page. This is the main block that is likely to be
                used within a template.

                Example:

                  {% block secondary_content %}
                    <h2>A sidebar item</h2>
                    <p>Some content for the item</p>
                  {% endblock %}
                #}
                {% block secondary_content %}{% endblock %}
              </aside>
            {% endblock %}

            {% block primary %}
              <div class="primary col-md-8 col-lg-9 col-xs-12" role="main">
                {#
                The primary_content block can be used to add content to the page.
                This is the main block that is likely to be used within a template.

                Example:

                  {% block primary_content %}
                    <h1>My page content</h1>
                    <p>Some content for the page</p>
                  {% endblock %}
                #}
                {% block primary_content %}
                  <article class="module">
                    {% block page_header %}
                      <header class="module-content page-header">
                        <ul class="nav nav-pills">
                          {% block content_primary_nav %}{% endblock %}
                        </ul>
                      </header>
                    {% endblock %}
                    <div class="module-content">
                      {% if self.page_primary_action() | trim %}
                        <div class="page_primary_action mb-3 mb-md-0">
                          {% block page_primary_action %}{% endblock %}
                        </div>
                      {% endif %}
                      {% block primary_content_inner %}
                      {% endblock %}
                    </div>
                  </article>
                {% endblock %}
              </div>
            {% endblock %}
          </div>
        {% endblock %}
      </div>
    </div>
  {% endblock -%}

  {#
  Override the footer on a page by page basis by extending this block. If
  making sitewide header changes it is preferable to override the footer.html-u
  file.
  #}
  {%- block footer %}
    {% include "footer.html" %}
  {% endblock -%}
{%- endblock -%}

{%- block scripts %}
  {% asset 'base/main' %}
  {% asset 'base/ckan' %}
  {{ super() }}
{% endblock -%}
