Added an index page at /help/state, listing the document states that

have help information.
 - Legacy-Id: 5837
This commit is contained in:
Henrik Levkowetz 2013-07-17 20:55:35 +00:00
parent cbfe489ff5
commit 51284a8871
3 changed files with 47 additions and 0 deletions

View file

@ -3,5 +3,6 @@ from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('',
url(r'^state/(?P<doc>[-\w]+)/(?P<type>[-\w]+)/?$', 'ietf.help.views.state'),
url(r'^state/(?P<doc>[-\w]+)/?$', 'ietf.help.views.state'),
url(r'^state/?$', 'ietf.help.views.index'),
)

View file

@ -8,6 +8,19 @@ import debug
from ietf.doc.models import State, StateType
def index(request):
types = StateType.objects.all()
names = [ type.slug for type in types ]
for type in types:
if "-" in type.slug and type.slug.split('-',1)[0] in names:
type.stategroups = None
else:
groups = StateType.objects.filter(slug__startswith=type.slug)
type.stategroups = [ g.slug[len(type.slug)+1:] for g in groups if not g == type ] or ""
return render_to_response('help/index.html', {"types": types},
context_instance=RequestContext(request))
def state(request, doc, type=None):
slug = "%s-%s" % (doc,type) if type else doc
debug.show('slug')

View file

@ -0,0 +1,33 @@
{% extends "base.html" %}
{# Copyright The IETF Trust 2007, All Rights Reserved #}
{% block title %} Document State Index{% endblock %}
{% block content %}
<h1>Document State Index</h1>
<p>Document state information is available for the following document and document state groups:</p>
<table class="ietf-table">
<tr>
<th>Document</th>
<th>State Groups</th>
</tr>
{% for type in types %}
{% if type.stategroups != None %}
<tr class="{% cycle oddrow,evenrow as cycle1 %}">
<td><a href='{{ type.slug }}/'>{{type.slug}}</td>
<td>
{% for group in type.stategroups %}
<a href='{{ type.slug }}/{{ group }}'>{{ group }}</a>
{% endfor %}
</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% endblock %}