Added an index page at /help/state, listing the document states that
have help information. - Legacy-Id: 5837
This commit is contained in:
parent
cbfe489ff5
commit
51284a8871
|
@ -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'),
|
||||
)
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
33
ietf/templates/help/index.html
Normal file
33
ietf/templates/help/index.html
Normal 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 %}
|
Loading…
Reference in a new issue