Skip to content

Commit c93e6a7

Browse files
committed
Made the popup position editing dialog work correctly for non-draft document types
- Legacy-Id: 4597
1 parent f3fd4db commit c93e6a7

3 files changed

Lines changed: 27 additions & 24 deletions

File tree

ietf/idrfc/views_doc.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -569,36 +569,39 @@ def get_ballot(name):
569569
from ietf.doc.models import DocAlias
570570
alias = get_object_or_404(DocAlias, name=name)
571571
d = alias.document
572-
id = get_object_or_404(InternetDraft, name=d.name)
573-
try:
574-
if not id.ballot.ballot_issued:
572+
id = None
573+
bw = None
574+
dw = None
575+
if (d.type_id=='draft'):
576+
id = get_object_or_404(InternetDraft, name=d.name)
577+
try:
578+
if not id.ballot.ballot_issued:
579+
raise Http404
580+
except BallotInfo.DoesNotExist:
575581
raise Http404
576-
except BallotInfo.DoesNotExist:
577-
raise Http404
582+
583+
bw = BallotWrapper(id) # XXX Fixme: Eliminate this as we go forward
584+
# Python caches ~100 regex'es -- explicitly compiling it inside a method
585+
# (where you then throw away the compiled version!) doesn't make sense at
586+
# all.
587+
if re.search("^rfc([1-9][0-9]*)$", name):
588+
id.viewing_as_rfc = True
589+
dw = RfcWrapper(id)
590+
else:
591+
dw = IdWrapper(id)
592+
# XXX Fixme: Eliminate 'dw' as we go forward
578593

579594
try:
580595
b = d.latest_event(BallotDocEvent, type="created_ballot")
581596
except BallotDocEvent.DoesNotExist:
582597
raise Http404
583598

584-
bw = BallotWrapper(id) # XXX Fixme: Eliminate this as we go forward
585-
586-
# Python caches ~100 regex'es -- explicitly compiling it inside a method
587-
# (where you then throw away the compiled version!) doesn't make sense at
588-
# all.
589-
if re.search("^rfc([1-9][0-9]*)$", name):
590-
id.viewing_as_rfc = True
591-
dw = RfcWrapper(id)
592-
else:
593-
dw = IdWrapper(id)
594-
# XXX Fixme: Eliminate 'dw' as we go forward
595-
596-
597599
return (bw, dw, b, d)
598600

599601
def ballot_html(request, name):
600602
bw, dw, ballot, doc = get_ballot(name)
601-
return render_to_response('idrfc/doc_ballot.html', {'bw':bw, 'dw':dw, 'ballot':ballot, 'doc':doc}, context_instance=RequestContext(request))
603+
content = document_ballot_content(request, doc, ballot.pk, editable=True)
604+
return HttpResponse(content)
602605

603606
def ballot_tsv(request, name):
604607
ballot, doc, b, d = get_ballot(name)

ietf/templates/idrfc/doc_ballot.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@
3333
-->{% endcomment %}
3434
{% load ietf_filters %}
3535
<table class="ietf-ballot"><tr valign="top"><td class="left">
36-
3736
{% if doc_ballot_edit_button and user|in_group:"Area_Director,Secretariat" %}
3837
{% if user|in_group:"Area_Director" %}
3938
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url idrfc.views_ballot.edit_position name=doc.name,ballot_id=ballot.pk %}">Edit position</a></span></span></div>
4039
{% endif %}
4140

42-
{% if bw.was_deferred %}
41+
{% if doc.active_defer_event %}
4342
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_undefer_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_undefer_ballot name=doc.name,ballot_id=ballot.pk %}">Undefer ballot</a></span></span></div>
44-
<div style="margin-top:8px; margin-bottom:8px;">Ballot deferred by {{ bw.deferred_by }} on {{ bw.deferred_date }}.</div>
43+
<div style="margin-top:8px; margin-bottom:8px;">Ballot deferred by {{ doc.active_defer_event.by }} on {{ doc.active_defer_event.time|date:"Y-m-d" }}.</div>
4544
{% else %}
4645
<div style="margin-top:8px; margin-bottom:8px;"><span id="doc_defer_ballot_button" class="yui-button yui-link-button"><span class="first-child"><a href="{% url doc_defer_ballot name=doc.name,ballot_id=ballot.pk %}">Defer ballot</a></span></span></div>
4746
{% endif %}

static/js/base.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ function showBallot(draftName, editPositionUrl) {
4646
document.getElementById("ietf-extras").appendChild(el);
4747

4848
var buttons = [{text:"Close", handler:handleClose, isDefault:true}];
49-
if (("Area_Director" in IETF.user_groups) ||
50-
("Secretariat" in IETF.user_groups)) {
49+
// if (("Area_Director" in IETF.user_groups) ||
50+
// ("Secretariat" in IETF.user_groups)) {
51+
if ("Area_Director" in IETF.user_groups) {
5152
buttons.unshift({text:"Edit Position", handler:handleEditPosition});
5253
}
5354
var kl = [new YAHOO.util.KeyListener(document, {keys:27}, handleClose)]

0 commit comments

Comments
 (0)