{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}{% translate 'Views' %}{% endblock %}

{% block main %}
  <section class="section">
    <div class="container">
      <h1 class="title">{% translate 'View documentation' %}</h1>
      <nav class="breadcrumb">
	<ul>
	  <li><a href="/admin/">首页</a></li>
	  <li><a href="{% url 'django-admindocs-docroot' %}">文档</a></li>
	  <li class="is-active"><a href="#" aria-current="page">视图</a></li>
	</ul>
      </nav>

      {% regroup views|dictsort:'namespace' by namespace as views_by_ns %}

      <div class="content has-background-light p-3">
	<h4>{% translate 'Jump to namespace' %}</h4>
	<ol>
	  {% for ns_views in views_by_ns %}
	    <li><a href="#ns|{{ ns_views.grouper }}">
	      {% if ns_views.grouper %}{{ ns_views.grouper }}
	      {% else %}{% translate "Empty namespace" %}{% endif %}
	    </a></li>
	  {% endfor %}
	</ol>
      </div>
      
      <div>
	{% for ns_views in views_by_ns %}
	  <div class="content">
	    <h2 id="ns|{{ ns_views.grouper }}">
	      {% if ns_views.grouper %}
		{% blocktranslate with ns_views.grouper as name %}Views by namespace {{ name }}{% endblocktranslate %}
	      {% else %}
		{% blocktranslate %}Views by empty namespace{% endblocktranslate %}
	      {% endif %}
	    </h2>

	    {% for view in ns_views.list|dictsort:"url" %}
	      {% ifchanged %}
		<h3><a href="{% url 'django-admindocs-views-detail' view=view.full_name %}">{{ view.url }}</a></h3>
		<p class="is-size-7">{% blocktranslate with view.full_name as full_name and view.url_name as url_name %}
		  View function: <code>{{ full_name }}</code>. Name: <code>{{ url_name }}</code>.
{% endblocktranslate %}</p>
<p>{{ view.title }}</p>
<hr>
	      {% endifchanged %}
	    {% endfor %}
	  </div>
	{% endfor %}
      </div>
    </div>
  </section>
{% endblock %}
