{% extends "admin/base_site.html" %}
{% load i18n static admin_urls admin_modify %}

{% block title %}{% trans 'Inspect' %} {% trans 'Key' %}: {{ key|truncatechars:200 }} - {{ original }}{% endblock %}

{% block extrahead %}
  {{ block.super }}
  <script src="{% url 'admin:jsi18n' %}"></script>
  {{ media }}
{% endblock %}

{% block extrastyle %}{{ block.super }}
  <link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}">
  <link rel="stylesheet" type="text/css" href="{% static 'redisboard/admin.css' %}"/>
{% endblock %}

{% block coltype %}colM{% endblock %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} inspect-form{% endblock %}

{% block breadcrumbs %}
  <div class="breadcrumbs">
    <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
    &rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
    &rsaquo; <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>
    &rsaquo; <a href="{% url opts|admin_urlname:'change' original.id %}">{{ original|truncatewords:"18" }}</a>
    &rsaquo; <a href="{% url opts|admin_urlname:'inspect' original.id %}">{% trans 'Inspect' %}</a>
    &rsaquo; <a href="{% url opts|admin_urlname:'inspect' original.id db.id %}">{% trans 'DB' %}: {{ db.id }}</a>
    &rsaquo; {% trans 'Key' %}: {{ key|truncatechars:200 }}
  </div>
{% endblock %}

{% block content %}
  {% spaceless %}
    <div id="content-main" class="module">
      <h1>{% trans "Inspect Key" %}</h1>
      <ul class="object-tools">
        <li><a href="{% url opts|admin_urlname:'details' original.id %}">{% trans "Details" %}</a></li>
        <li><a href="{% url opts|admin_urlname:'change' original.id %}">{% trans "Change" %}</a></li>
      </ul>

      <fieldset class="module aligned key-details">
        <h2>{% trans "Stats" %}</h2>
        {{ stats }}
      </fieldset>
      <fieldset class="module aligned key-data">
        <h2>{% trans "Value" %}</h2>
        {{ scan.data }}
        {% if scan.cursor or db.cursor %}
          <p class="paginator">
            {% if db.cursor %}
              <a
                href="{% url 'admin:redisboard_redisserver_inspect' server_id=original.id db=db.id key=encoded_key %}">{% trans 'Reset' %}</a>
            {% endif %}
            <span class="this-page">at cursor: {{ db.cursor }}</span>
            {% if scan.cursor %}
              <a
                href="{% url 'admin:redisboard_redisserver_inspect' server_id=original.id db=db.id key=encoded_key cursor=scan.cursor count=count %}">{% trans 'Next' %}</a>
            {% endif %}
          </p>
        {% endif %}
      </fieldset>
    </div>
  {% endspaceless %}
{% endblock %}
