Add a generic state help page, make provisions for displaying

IESG I-D states in it
 - Legacy-Id: 5635
This commit is contained in:
Ole Laursen 2013-04-10 16:11:27 +00:00
parent 3d1eb07afe
commit 4db36b0fbc
8 changed files with 107 additions and 41 deletions

45
ietf/doc/views_help.py Normal file
View file

@ -0,0 +1,45 @@
from django import forms
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from ietf.doc.models import *
def state_help(request, type):
slug, title = {
"draft-iesg": ("draft-iesg", "IESG States For Internet-Drafts"),
"draft-rfceditor": ("draft-rfceditor", "RFC Editor States For Internet-Drafts"),
"draft-iana-action": ("draft-iana-action", "IANA Action States For Internet-Drafts"),
"charter": ("charter", "Charter States"),
"conflict-review": ("conflrev", "Conflict Review States")
}.get(type, "")
state_type = get_object_or_404(StateType, slug=slug)
states = State.objects.filter(type=state_type).order_by("order")
has_next_states = False
for state in states:
if state.next_states.all():
has_next_states = True
break
tags = []
if state_type.slug == "draft-iesg":
# legacy hack
states = list(states)
fake_state = dict(name="I-D Exists",
desc="Initial (default) state for all internet drafts. Such documents are not being tracked by the IESG as no request has been made of the IESG to do anything with the document.",
next_states=dict(all=State.objects.filter(type="draft-iesg", slug__in=("watching", "pub-req")))
)
states.insert(0, fake_state)
tags = DocTagName.objects.filter(slug__in=IESG_SUBSTATE_TAGS)
return render_to_response("doc/state_help.html", {
"title": title,
"state_type": state_type,
"states": states,
"has_next_states": has_next_states,
"tags": tags,
},
context_instance=RequestContext(request))

View file

@ -80,13 +80,8 @@ urlpatterns = patterns('',
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/approveballot/$', views_ballot.approve_ballot, name='doc_approve_ballot'),
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/makelastcall/$', views_ballot.make_last_call, name='doc_make_last_call'),
url(r'^help/state/(?P<type>[\w-]+)/$', 'ietf.doc.views_help.state_help', name="state_help"),
(r'^(?P<name>charter-[A-Za-z0-9._+-]+)/', include('ietf.wgcharter.urls')),
(r'^(?P<name>[A-Za-z0-9._+-]+)/conflict-review/', include('ietf.doc.urls_conflict_review')),
)
urlpatterns += patterns('django.views.generic.simple',
url(r'^help/state/charter/$', 'direct_to_template', { 'template': 'doc/states.html', 'extra_context': { 'states': State.objects.filter(type="charter"),'title':"Charter" } }, name='help_charter_states'),
url(r'^help/state/conflict-review/$', 'direct_to_template', { 'template': 'doc/states.html', 'extra_context': { 'states': State.objects.filter(type="conflrev").order_by("order"),'title':"Conflict Review" } }, name='help_conflict_review_states'),
)

View file

@ -20,7 +20,7 @@ form.change-state .actions {
{% block content %}
<h1>Change State: {{doc.title}}</h1>
<p class="helptext">For help on the states, see the <a href="{% url help_conflict_review_states %}">state table</a>.</p>
<p class="helptext">For help on the states, see the <a href="{% url state_help type="conflict-review" %}">state table</a>.</p>
<form class="change-state" action="" method="post">
<table>

View file

@ -18,7 +18,7 @@ form.start-conflict-review .actions {
{% block content %}
<h1>Begin IETF conflict review for {{doc_to_review.canonical_name}}-{{doc_to_review.rev}}</h1>
<p class="helptext">For help on the initial state choice, see the <a href="{% url help_conflict_review_states %}">state table</a>.</p>
<p class="helptext">For help on the initial state choice, see the <a href="{% url state_help type="conflict-review" %}">state table</a>.</p>
<form class="start-conflict-review" action="" method="post">
<table>

View file

@ -0,0 +1,57 @@
{% extends "base.html" %}
{% block title %}{{ title }}{% endblock %}
{% block morecss %}
.ietf-table .name { white-space: nowrap; padding-right: 1em; }
.ietf-table .desc { max-width: 35em; }
{% endblock %}
{% block content %}
<h1>{{ title }}</h1>
{% if state_type.slug == "draft-iesg" %}
<p><a href="/images/iesg_draft_state_diagram.png">View Diagram</a></p>
{% endif %}
<table class="ietf-table">
<tr>
<th>State</th>
<th>Description</th>
{% if has_next_states %}<th>Next State</th>{% endif %}
</tr>
{% for state in states %}
<tr id="{{ state.slug }}" class="{{ forloop.counter|divisibleby:2|yesno:"evenrow,oddrow" }}">
<td class="name">{{ state.name }}</td>
<td class="desc">{{ state.desc|linebreaksbr }}</td>
{% if has_next_states %}
<td class="name">
{% for s in state.next_states.all %}
{{ s.name }}<br/>
{% endfor %}
</td>
{% endif %}
</tr>
{% endfor %}
</table>
{% if tags %}
<h2>Tags</h2>
<table class="ietf-table">
<tr>
<th>Tag</th>
<th>Description</th>
</tr>
{% for tag in tags %}
<tr id="{{ tag.slug }}" class="{{ forloop.counter|divisibleby:2|yesno:"evenrow,oddrow" }}">
<td class="name">{{ tag.name }}</td>
<td class="desc">{{ tag.desc|linebreaksbr }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}

View file

@ -1,31 +0,0 @@
{% extends "base.html" %}
{% block title %}{{ title }} States{% endblock %}
{% block morecss %}
.state_column {
width: 13em;
}
{% endblock %}
{% block content %}
<h1>{{ title }} States</h1>
<table class="ietf-table">
<tr>
<th class="state_column">State</th>
<th>Description</th>
</tr>
<tr class="{% cycle oddrow,evenrow as cycle1 %}"></tr>
{% for state in states %}
<tr class="{% cycle cycle1 %}">
<td>{{ state.name|escape }}</td>
<td>{{ state.desc|escape }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}

View file

@ -21,7 +21,7 @@ form.change-state .actions {
<h1>{{ title }}</h1>
{% if not option %}
<p class="helptext">For help on the states, see the <a href="{% url help_charter_states %}">state table</a>.</p>
<p class="helptext">For help on the states, see the <a href="{% url state_help type="charter" %}">state table</a>.</p>
{% endif %}
<form class="change-state" action="" method="post">

View file

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB