From 715edafcdca16ea89797628d9cea2c3d2ee5ac36 Mon Sep 17 00:00:00 2001 From: Matthew Holloway Date: Thu, 29 Aug 2024 00:51:05 +1200 Subject: [PATCH] fix: return to ballotpopup (#7858) * fix: return to ballotpopup * fix: ballot position return to in modals * fix: ballot return to test * fix: ballot return to additional allow handlers * fix: ballot return to handler syntax error in test --- ietf/doc/templatetags/ballot_icon.py | 13 +++++++++++-- ietf/doc/tests_ballot.py | 20 ++++++++------------ ietf/doc/views_ballot.py | 13 +++++++++++++ ietf/doc/views_doc.py | 10 +++++++++- ietf/templates/doc/ballot_popup.html | 2 +- 5 files changed, 42 insertions(+), 16 deletions(-) diff --git a/ietf/doc/templatetags/ballot_icon.py b/ietf/doc/templatetags/ballot_icon.py index ebcc605cd5..5f59822c7b 100644 --- a/ietf/doc/templatetags/ballot_icon.py +++ b/ietf/doc/templatetags/ballot_icon.py @@ -96,9 +96,14 @@ def sort_key(t): positions = list(ballot.active_balloter_positions().items()) positions.sort(key=sort_key) + request = context.get("request") + ballot_edit_return_point_param = f"ballot_edit_return_point={request.path}" + right_click_string = '' if has_role(user, "Area Director"): - right_click_string = 'oncontextmenu="window.location.href=\'%s\';return false;"' % urlreverse('ietf.doc.views_ballot.edit_position', kwargs=dict(name=doc.name, ballot_id=ballot.pk)) + right_click_string = 'oncontextmenu="window.location.href=\'{}?{}\';return false;"'.format( + urlreverse('ietf.doc.views_ballot.edit_position', kwargs=dict(name=doc.name, ballot_id=ballot.pk)), + ballot_edit_return_point_param) my_blocking = False for i, (balloter, pos) in enumerate(positions): @@ -113,10 +118,14 @@ def sort_key(t): typename = "RSAB" else: typename = "IESG" + + modal_url = "{}?{}".format( + urlreverse("ietf.doc.views_doc.ballot_popup", kwargs=dict(name=doc.name, ballot_id=ballot.pk)), + ballot_edit_return_point_param) res = [' + href="{% url "ietf.doc.views_ballot.edit_position" name=doc.name ballot_id=ballot_id %}?ballot_edit_return_point={{ ballot_edit_return_point|urlencode }}"> Edit position {% endif %}