Skip to content

Commit 51284a8

Browse files
committed
Added an index page at /help/state, listing the document states that
have help information. - Legacy-Id: 5837
1 parent cbfe489 commit 51284a8

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

ietf/help/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
urlpatterns = patterns('',
44
url(r'^state/(?P<doc>[-\w]+)/(?P<type>[-\w]+)/?$', 'ietf.help.views.state'),
55
url(r'^state/(?P<doc>[-\w]+)/?$', 'ietf.help.views.state'),
6+
url(r'^state/?$', 'ietf.help.views.index'),
67
)
78

ietf/help/views.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
from ietf.doc.models import State, StateType
99

1010

11+
def index(request):
12+
types = StateType.objects.all()
13+
names = [ type.slug for type in types ]
14+
for type in types:
15+
if "-" in type.slug and type.slug.split('-',1)[0] in names:
16+
type.stategroups = None
17+
else:
18+
groups = StateType.objects.filter(slug__startswith=type.slug)
19+
type.stategroups = [ g.slug[len(type.slug)+1:] for g in groups if not g == type ] or ""
20+
21+
return render_to_response('help/index.html', {"types": types},
22+
context_instance=RequestContext(request))
23+
1124
def state(request, doc, type=None):
1225
slug = "%s-%s" % (doc,type) if type else doc
1326
debug.show('slug')

ietf/templates/help/index.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{% extends "base.html" %}
2+
{# Copyright The IETF Trust 2007, All Rights Reserved #}
3+
4+
{% block title %} Document State Index{% endblock %}
5+
6+
{% block content %}
7+
8+
<h1>Document State Index</h1>
9+
10+
<p>Document state information is available for the following document and document state groups:</p>
11+
12+
<table class="ietf-table">
13+
<tr>
14+
<th>Document</th>
15+
<th>State Groups</th>
16+
</tr>
17+
18+
{% for type in types %}
19+
{% if type.stategroups != None %}
20+
<tr class="{% cycle oddrow,evenrow as cycle1 %}">
21+
<td><a href='{{ type.slug }}/'>{{type.slug}}</td>
22+
<td>
23+
{% for group in type.stategroups %}
24+
<a href='{{ type.slug }}/{{ group }}'>{{ group }}</a>
25+
{% endfor %}
26+
</td>
27+
</tr>
28+
{% endif %}
29+
{% endfor %}
30+
</table>
31+
32+
33+
{% endblock %}

0 commit comments

Comments
 (0)