Merged [2496] from rjsparks@nostrum.com: Changed the navigation round editing ballots and sending discuss/email so that the user comes back to the page the edit started from.
- Legacy-Id: 2519 Note: SVN reference [2496] has been migrated to Git commit eccf544ee4f12b00ed3030115f487720ae330fee
This commit is contained in:
parent
d3292a84f0
commit
51ab79364c
|
@ -421,7 +421,6 @@ class EditPositionTestCase(django.test.TestCase):
|
|||
self.assertEquals(len(pos), 0)
|
||||
self.assertEquals(draft.idinternal.comments().count(), comments_before + 1)
|
||||
self.assertTrue("Position" in draft.idinternal.comments()[0].comment_text)
|
||||
|
||||
def test_edit_position_as_secretary(self):
|
||||
draft = InternetDraft.objects.get(filename="draft-ietf-mipshop-pfmipv6")
|
||||
url = urlreverse('doc_edit_position', kwargs=dict(name=draft.filename))
|
||||
|
|
|
@ -55,6 +55,7 @@ class EditPositionForm(forms.Form):
|
|||
position = forms.ChoiceField(choices=BALLOT_CHOICES, widget=forms.RadioSelect, required=False)
|
||||
discuss_text = forms.CharField(required=False, widget=forms.Textarea)
|
||||
comment_text = forms.CharField(required=False, widget=forms.Textarea)
|
||||
return_to_url = forms.CharField(required=False, widget=forms.HiddenInput)
|
||||
|
||||
@group_required('Area_Director','Secretariat')
|
||||
def edit_position(request, name):
|
||||
|
@ -65,6 +66,12 @@ def edit_position(request, name):
|
|||
|
||||
ad = login = IESGLogin.objects.get(login_name=request.user.username)
|
||||
|
||||
if 'HTTP_REFERER' in request.META:
|
||||
return_to_url = request.META['HTTP_REFERER']
|
||||
else:
|
||||
return_to_url = doc.idinternal.get_absolute_url()
|
||||
|
||||
|
||||
# if we're in the Secretariat, we can select an AD to act as stand-in for
|
||||
if not in_group(request.user, "Area_Director"):
|
||||
ad_username = request.GET.get('ad')
|
||||
|
@ -77,8 +84,13 @@ def edit_position(request, name):
|
|||
if request.method == 'POST':
|
||||
form = EditPositionForm(request.POST)
|
||||
if form.is_valid():
|
||||
|
||||
# save the vote
|
||||
clean = form.cleaned_data
|
||||
|
||||
if clean['return_to_url']:
|
||||
return_to_url = clean['return_to_url']
|
||||
|
||||
vote = clean['position']
|
||||
if pos:
|
||||
# mark discuss as cleared (quirk from old system)
|
||||
|
@ -142,13 +154,14 @@ def edit_position(request, name):
|
|||
|
||||
doc.idinternal.event_date = date.today()
|
||||
doc.idinternal.save()
|
||||
|
||||
if request.POST.get("send_mail"):
|
||||
qstr = ""
|
||||
qstr = "?return_to_url=%s" % return_to_url
|
||||
if request.GET.get('ad'):
|
||||
qstr = "?ad=%s" % request.GET.get('ad')
|
||||
qstr += "&ad=%s" % request.GET.get('ad')
|
||||
return HttpResponseRedirect(urlreverse("doc_send_ballot_comment", kwargs=dict(name=doc.filename)) + qstr)
|
||||
else:
|
||||
return HttpResponseRedirect(doc.idinternal.get_absolute_url())
|
||||
return HttpResponseRedirect(return_to_url)
|
||||
else:
|
||||
initial = {}
|
||||
if pos:
|
||||
|
@ -159,15 +172,21 @@ def edit_position(request, name):
|
|||
|
||||
if comment:
|
||||
initial['comment_text'] = comment.text
|
||||
|
||||
if return_to_url:
|
||||
initial['return_to_url'] = return_to_url
|
||||
|
||||
form = EditPositionForm(initial=initial)
|
||||
|
||||
|
||||
return render_to_response('idrfc/edit_position.html',
|
||||
dict(doc=doc,
|
||||
form=form,
|
||||
discuss=discuss,
|
||||
comment=comment,
|
||||
ad=ad),
|
||||
ad=ad,
|
||||
return_to_url=return_to_url,
|
||||
),
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
@group_required('Area_Director','Secretariat')
|
||||
|
@ -178,6 +197,18 @@ def send_ballot_comment(request, name):
|
|||
raise Http404()
|
||||
|
||||
ad = login = IESGLogin.objects.get(login_name=request.user.username)
|
||||
|
||||
return_to_url = request.GET.get('return_to_url')
|
||||
if not return_to_url:
|
||||
return_to_url = doc.idinternal.get_absolute_url()
|
||||
|
||||
if 'HTTP_REFERER' in request.META:
|
||||
back_url = request.META['HTTP_REFERER']
|
||||
else:
|
||||
back_url = doc.idinternal.get_absolute_url()
|
||||
|
||||
|
||||
|
||||
# if we're in the Secretariat, we can select an AD to act as stand-in for
|
||||
if not in_group(request.user, "Area_Director"):
|
||||
ad_username = request.GET.get('ad')
|
||||
|
@ -210,7 +241,7 @@ def send_ballot_comment(request, name):
|
|||
|
||||
send_mail_text(request, to, frm, subject, body, cc=", ".join(cc))
|
||||
|
||||
return HttpResponseRedirect(doc.idinternal.get_absolute_url())
|
||||
return HttpResponseRedirect(return_to_url)
|
||||
|
||||
return render_to_response('idrfc/send_ballot_comment.html',
|
||||
dict(doc=doc,
|
||||
|
@ -219,7 +250,9 @@ def send_ballot_comment(request, name):
|
|||
frm=frm,
|
||||
to=to,
|
||||
ad=ad,
|
||||
can_send=d or c),
|
||||
can_send=d or c,
|
||||
back_url=back_url,
|
||||
),
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
|
|
|
@ -51,10 +51,13 @@ form.position-form .comment-text {
|
|||
{{ form.comment_text }}
|
||||
|
||||
<div class="actions">
|
||||
<a href="{{ doc.idinternal.get_absolute_url }}">Back</a>
|
||||
<a href="{{ return_to_url }}">Back</a>
|
||||
<input type="submit" name="send_mail" value="Save and send email"/>
|
||||
<input type="submit" value="Save"/>
|
||||
</div>
|
||||
|
||||
{{ form.return_to_url }}
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ form.send-ballot pre {
|
|||
<tr>
|
||||
<td></td>
|
||||
<td class="actions">
|
||||
<a href="{{ doc.idinternal.get_absolute_url }}">Back</a>
|
||||
<a href="{{ back_url }}">Back</a>
|
||||
<input type="submit" value="Send"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue