From cbc660e7fb16483f1a281e1d1774ea2e2313063d Mon Sep 17 00:00:00 2001 From: Ryan Cross Date: Sat, 24 Mar 2012 14:48:24 +0000 Subject: [PATCH] Ticket #673 Add ability to clear ballot - Legacy-Id: 4212 --- ietf/idrfc/urls.py | 1 + ietf/idrfc/views_ballot.py | 17 +++++++++++++++++ ietf/templates/idrfc/clear_ballot.html | 18 ++++++++++++++++++ ietf/templates/idrfc/doc_ballot.html | 4 ++++ 4 files changed, 40 insertions(+) create mode 100644 ietf/templates/idrfc/clear_ballot.html diff --git a/ietf/idrfc/urls.py b/ietf/idrfc/urls.py index 1585d6673..5de204915 100644 --- a/ietf/idrfc/urls.py +++ b/ietf/idrfc/urls.py @@ -53,6 +53,7 @@ urlpatterns = patterns('', url(r'^(?P[A-Za-z0-9.-]+)/edit/resurrect/$', views_edit.resurrect, name='doc_resurrect'), url(r'^(?P[A-Za-z0-9.-]+)/edit/addcomment/$', views_edit.add_comment, name='doc_add_comment'), url(r'^(?P[A-Za-z0-9.-]+)/edit/position/$', views_ballot.edit_position, name='doc_edit_position'), + url(r'^(?P[A-Za-z0-9.-]+)/edit/clearballot/$', views_ballot.clear_ballot, name='doc_clear_ballot'), url(r'^(?P[A-Za-z0-9.-]+)/edit/deferballot/$', views_ballot.defer_ballot, name='doc_defer_ballot'), url(r'^(?P[A-Za-z0-9.-]+)/edit/undeferballot/$', views_ballot.undefer_ballot, name='doc_undefer_ballot'), url(r'^(?P[A-Za-z0-9.-]+)/edit/sendballotcomment/$', views_ballot.send_ballot_comment, name='doc_send_ballot_comment'), diff --git a/ietf/idrfc/views_ballot.py b/ietf/idrfc/views_ballot.py index 16d45a9b8..cb090fc9e 100644 --- a/ietf/idrfc/views_ballot.py +++ b/ietf/idrfc/views_ballot.py @@ -511,6 +511,23 @@ def send_ballot_commentREDESIGN(request, name): if settings.USE_DB_REDESIGN_PROXY_CLASSES: send_ballot_comment = send_ballot_commentREDESIGN +@group_required('Secretariat') +def clear_ballot(request, name): + """Clear all positions and discusses. This is actually accomplished by creating a new + started_iesg_process DocEvent.""" + doc = get_object_or_404(Document, name=name) + if request.method == 'POST': + DocEvent.objects.create(type='started_iesg_process', + doc=doc, + by=request.user.get_profile(), + desc='cleared_ballot') + + return HttpResponseRedirect(urlreverse("doc_view", kwargs=dict(name=doc.name))) + + return render_to_response('idrfc/clear_ballot.html', + dict(doc=doc, + back_url=doc.get_absolute_url()), + context_instance=RequestContext(request)) @group_required('Area_Director','Secretariat') def defer_ballot(request, name): diff --git a/ietf/templates/idrfc/clear_ballot.html b/ietf/templates/idrfc/clear_ballot.html new file mode 100644 index 000000000..1fd438c94 --- /dev/null +++ b/ietf/templates/idrfc/clear_ballot.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} + +{% block title %}Clear ballot for {{ doc }}{% endblock %} + +{% block content %} +

Clear ballot for {{ doc }}

+ +
+

Clear the ballot for {{ doc.file_tag }}?

+ +

This will clear all ballot positions and discuss entries.

+ +
+ Back + +
+
+{% endblock %} diff --git a/ietf/templates/idrfc/doc_ballot.html b/ietf/templates/idrfc/doc_ballot.html index 46f2aae48..af7f74e99 100644 --- a/ietf/templates/idrfc/doc_ballot.html +++ b/ietf/templates/idrfc/doc_ballot.html @@ -48,6 +48,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. {% endif %} +{% if doc_ballot_edit_button and user|in_group:"Secretariat" %} + +{% endif %} +

Discuss
{% with ballot.get_discuss as positions %}{% include "idrfc/doc_ballot_list.html" %}{% endwith %}