{% extends "package/base.html" %}

{% set default_group_type = h.default_group_type('group') %}

{% block subtitle %}{{ h.dataset_display_name(pkg) }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %}

{% block head_extras -%}
  {{ super() }}
  {% set description = h.markdown_extract(pkg.notes, extract_length=200)|forceescape %}
  <meta property="og:title" content="{{ h.dataset_display_name(pkg) }} - {{ g.site_title }}">
  <meta property="og:description" content="{{ description|forceescape|trim }}">
{% endblock -%}

{% block content_action %}
  {% if h.check_access('package_update', {'id':pkg.id }) %}
    {% link_for _('Manage'), named_route=pkg.type ~ '.edit', id=pkg.name, class_='btn btn-light', icon='wrench' %}
  {% endif %}
{% endblock %}

{% block content_primary_nav %}
  {{ h.build_nav_icon(dataset_type ~ '.read', _('Dataset'),  id=pkg.name, icon='sitemap') }}
  {{ h.build_nav_icon(dataset_type ~ '.groups', h.humanize_entity_type('group', default_group_type, 'content tab') or _('Groups'), id=pkg.name, icon='users') }}
{% endblock %}

{% block secondary_content %}

  {% block secondary_help_content %}{% endblock %}

  {% block package_info %}
    {% snippet 'package/snippets/info.html', pkg=pkg %}
  {% endblock %}

  {% block package_organization %}
    {% if pkg.organization %}
      {% set org = h.get_organization(pkg.organization.id) %}
      {% snippet "snippets/organization.html", organization=org, has_context_title=true %}
    {% endif %}
  {% endblock %}

  {% block package_social %}
    {% snippet "snippets/social.html" %}
  {% endblock %}

  {% block package_license %}
    {% snippet "snippets/license.html", pkg_dict=pkg %}
  {% endblock %}

{% endblock %}
