Added a set of help pages for document states (at /help/state/<doctype>/<statetype>/).

- Legacy-Id: 5467
This commit is contained in:
Henrik Levkowetz 2013-02-27 22:01:18 +00:00
parent 73e6f35d9a
commit fa93d26c01
7 changed files with 78 additions and 0 deletions

0
ietf/help/__init__.py Normal file
View file

1
ietf/help/models.py Normal file
View file

@ -0,0 +1 @@
# Empty

23
ietf/help/tests.py Normal file
View file

@ -0,0 +1,23 @@
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.failUnlessEqual(1 + 1, 2)
__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.
>>> 1 + 1 == 2
True
"""}

7
ietf/help/urls.py Normal file
View file

@ -0,0 +1,7 @@
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'),
)

18
ietf/help/views.py Normal file
View file

@ -0,0 +1,18 @@
# Copyright The IETF Trust 2007, All Rights Reserved
from django.template import RequestContext
from django.shortcuts import get_object_or_404, render_to_response
import debug
from doc.models import State, StateType
def state(request, doc, type=None):
slug = "%s-%s" % (doc,type) if type else doc
debug.show('slug')
statetype = get_object_or_404(StateType, slug=slug)
states = State.objects.filter(type=statetype).order_by('order')
return render_to_response('help/states.html', {"doc": doc, "type": statetype, "states":states},
context_instance=RequestContext(request))

View file

@ -0,0 +1,28 @@
{% extends "base.html" %}
{# Copyright The IETF Trust 2007, All Rights Reserved #}
{% block title %} {{type.label|cut:"state"|cut:"State"}} Statess{% endblock %}
{% block content %}
<h1>{{type.label|cut:"state"|cut:"State"}} States</h1>
<table class="ietf-table">
<tr>
<th>State</th>
<th>Description</th>
<th>Next State</th>
</tr>
{% for state in states %}
<tr class="{% cycle oddrow,evenrow as cycle1 %}">
<td>{{ state.name }}</td>
<td>{{ state.desc|safe }}</td>
<td><ul>{% for s in state.next_states.all %}<li>{{ s.name }}</li>{%endfor%}</ul></td>
</tr>
{% endfor %}
</table>
{% endblock %}

View file

@ -69,6 +69,7 @@ urlpatterns = patterns('',
(r'^(?P<path>public)/', include('ietf.redirects.urls')), (r'^(?P<path>public)/', include('ietf.redirects.urls')),
(r'^wg/', include('ietf.wginfo.urls')), (r'^wg/', include('ietf.wginfo.urls')),
(r'^sync/', include('ietf.sync.urls')), (r'^sync/', include('ietf.sync.urls')),
(r'^help/', include('ietf.help.urls')),
# Google webmaster tools verification url # Google webmaster tools verification url
(r'^googlea30ad1dacffb5e5b.html', 'django.views.generic.simple.direct_to_template', { 'template': 'googlea30ad1dacffb5e5b.html' }), (r'^googlea30ad1dacffb5e5b.html', 'django.views.generic.simple.direct_to_template', { 'template': 'googlea30ad1dacffb5e5b.html' }),