Fixed a bug in /help/state/ (bad links). Linked additional state labels in the document pages to the state descriptions under /help/state. Renamed a template file to better match its function.
- Legacy-Id: 9410
This commit is contained in:
parent
786208e3ba
commit
7488adef5b
30
ietf/help/tests_views.py
Normal file
30
ietf/help/tests_views.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
"""
|
||||
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 pyquery import PyQuery
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.utils.test_utils import TestCase
|
||||
from ietf.doc.models import StateType
|
||||
|
||||
class StateHelpTest(TestCase):
|
||||
|
||||
def test_state_index(self):
|
||||
url = reverse('ietf.help.views.state_index')
|
||||
r = self.client.get(url)
|
||||
q = PyQuery(r.content)
|
||||
content = [ e.text for e in q('#content table td a ') ]
|
||||
names = StateType.objects.values_list('slug', flat=True)
|
||||
# The following doesn't cover all doc types, only a selection
|
||||
for name in names:
|
||||
if not '-' in name:
|
||||
self.assertIn(name, content)
|
||||
|
||||
|
|
@ -3,6 +3,6 @@ from django.conf.urls 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'),
|
||||
url(r'^state/?$', 'ietf.help.views.state_index'),
|
||||
)
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ from django.shortcuts import get_object_or_404, render_to_response
|
|||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.doc.models import State, StateType
|
||||
from ietf.name.models import StreamName
|
||||
|
||||
|
||||
def index(request):
|
||||
def state_index(request):
|
||||
types = StateType.objects.all()
|
||||
names = [ type.slug for type in types ]
|
||||
for type in types:
|
||||
|
@ -20,10 +20,17 @@ def index(request):
|
|||
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},
|
||||
return render_to_response('help/state_index.html', {"types": types},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
def state(request, doc, type=None):
|
||||
if type:
|
||||
debug.show('type')
|
||||
streams = [ s.slug for s in StreamName.objects.all() ]
|
||||
debug.show('streams')
|
||||
if type in streams:
|
||||
type = "stream-%s" % type
|
||||
debug.show('type')
|
||||
slug = "%s-%s" % (doc,type) if type else doc
|
||||
statetype = get_object_or_404(StateType, slug=slug)
|
||||
states = State.objects.filter(used=True, type=statetype).order_by('order')
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
|
||||
<tr>
|
||||
{% if doc.stream %}
|
||||
<th>{{ doc.stream }} state</th>
|
||||
<th><a href="{% url "ietf.help.views.state" doc=doc.type.slug type=doc.stream.slug %}">{{ doc.stream }} state</th>
|
||||
<td class="edit">
|
||||
{% if doc.stream and can_edit_stream_info %}
|
||||
<a class="btn btn-default btn-xs" href="{% url "doc_change_stream_state" name=doc.name state_type=stream_state_type_slug %}">Edit</a>
|
||||
|
@ -211,7 +211,7 @@
|
|||
{% endif %}
|
||||
|
||||
<tr>
|
||||
<th><a href="{% url "state_help" "draft-iesg" %}">IESG state</a></th>
|
||||
<th><a href="{% url "ietf.help.views.state" doc=doc.type.slug type="iesg" %}">IESG state</a></th>
|
||||
<td class="edit">
|
||||
{% if iesg_state and can_edit %}
|
||||
<a class="btn btn-default btn-xs" href="{% url "doc_change_state" name=doc.name %}">Edit</a>
|
||||
|
@ -224,7 +224,7 @@
|
|||
|
||||
{% if iana_review_state %}
|
||||
<tr>
|
||||
<th>IANA review state</th>
|
||||
<th><a href="{% url "ietf.help.views.state" doc=doc.type.slug type="iana-review" %}">IANA review state</a></th>
|
||||
<td class="edit">
|
||||
{% if can_edit_iana_state %}
|
||||
<a class="btn btn-default btn-xs" href="{% url "doc_change_iana_state" name=doc.name state_type="iana-review" %}">Edit</a>
|
||||
|
@ -250,7 +250,7 @@
|
|||
|
||||
{% if rfc_editor_state %}
|
||||
<tr>
|
||||
<th>RFC Editor state</th>
|
||||
<th><a href="{% url "ietf.help.views.state" doc=doc.type.slug type="rfceditor" %}">RFC Editor state</a></th>
|
||||
<td class="edit"></td>
|
||||
<td><a href="//www.rfc-editor.org/queue2.html#{{ doc.name }}">{{ rfc_editor_state }}</a></td>
|
||||
</tr>
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
{% for type in types %}
|
||||
{% if type.stategroups != None %}
|
||||
<tr>
|
||||
<td><a href='state/{{ type.slug }}/'>{{type.slug}}</a></td>
|
||||
<td><a href='{{ type.slug }}/'>{{type.slug}}</a></td>
|
||||
<td>
|
||||
{% for group in type.stategroups %}
|
||||
<a href='state/{{ type.slug }}/{{ group }}'>{{ group }}</a>{% if not forloop.last %}, {% endif %}
|
||||
<a href='{{ type.slug }}/{{ group }}'>{{ group }}</a>{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
Loading…
Reference in a new issue