{% extends "admin/change_form.html" %}
{% load i18n admin_urls admin_relation_modify %}

{% if not is_popup %}
  {% block breadcrumbs %}
    {% spaceless %}
      <nav class="breadcrumb">
        {% relation_admin_breadcrumbs %}
        {% if has_change_permission %}
          <a class="breadcrumb-item" href="{% relation_admin_url 'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>
        {% else %}
          <span class="breadcrumb-item">{{ opts.verbose_name_plural|capfirst }}</span>
        {% endif %}
        <span class="breadcrumb-item active">{% if add %}{% trans 'Add' %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}</span>
      </nav>
    {% endspaceless %}
  {% endblock %}
{% endif %}

{% block object-tools-items %}
  {% relation_admin_url 'history' original.pk|admin_urlquote as history_url %}
  {% if history_url %}
    <li>
      <a href="{{ history_url }}" class="btn historylink btn-link link-body-emphasis">
        <i class="fa fa-book"></i> {% trans "History" %}
      </a>
    </li>
  {% endif %}
  {% if has_absolute_url %}
    <li>
      <a href="{{ absolute_url }}" class="btn btn-link viewsitelink">
        <i class="fa fa-globe"></i> {% trans "View on site" %}
      </a>
    </li>
  {% endif %}
{% endblock %}

{% block object-toolbar-cancel %}
  <a href="{% relation_admin_url 'changelist' %}" class="btn btn-secondary">{% trans 'Cancel' %}</a>
{% endblock %}

{% block content %}
  {% block relation_admin_navigation %}
    {% relation_admin_navigation %}
  {% endblock %}
  {{ block.super }}
{% endblock %}

{% block submit_buttons_bottom %}{% relation_admin_submit_row %}{% endblock %}
