From 98bf7afeab76cf4a1eff3b1563b96089ab98dbbb Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Mon, 26 Jun 2023 17:10:05 -0400 Subject: [PATCH] feat: Display and bulk-edit nomcom position flags (#4681) (#5878) This adds a table to show the state of all nomcom positions, and lets the chair set or un-set multiple state flags at the same time. As a consequence, it moves the email templates to the "Edit position" form. --- ietf/nomcom/views.py | 35 +++++ ietf/templates/nomcom/edit_position.html | 11 +- ietf/templates/nomcom/list_positions.html | 163 ++++++++++++++++------ 3 files changed, 164 insertions(+), 45 deletions(-) diff --git a/ietf/nomcom/views.py b/ietf/nomcom/views.py index c077afce4c..d43f227c08 100644 --- a/ietf/nomcom/views.py +++ b/ietf/nomcom/views.py @@ -1106,6 +1106,41 @@ def edit_template(request, year, template_id): def list_positions(request, year): nomcom = get_nomcom_by_year(year) positions = nomcom.position_set.order_by('-is_open') + if request.method == 'POST': + if nomcom.group.state_id != 'active': + messages.warning(request, "This nomcom is not active. Request administrative assistance if Position state needs to change.") + else: + action = request.POST.get('action') + positions_to_modify = request.POST.getlist('selected') + if positions_to_modify: + positions = positions.filter(id__in=positions_to_modify) + if action == "set_iesg": + positions.update(is_iesg_position=True) + messages.success(request,'The selected positions have been set as IESG Positions') + elif action == "unset_iesg": + positions.update(is_iesg_position=False) + messages.success(request,'The selected positions have been set as NOT IESG Positions') + elif action == "set_open": + positions.update(is_open=True) + messages.success(request,'The selected positions have been set as Open') + elif action == "unset_open": + positions.update(is_open=False) + messages.success(request,'The selected positions have been set as NOT Open') + elif action == "set_accept_nom": + positions.update(accepting_nominations=True) + messages.success(request,'The selected positions have been set as Accepting Nominations') + elif action == "unset_accept_nom": + positions.update(accepting_nominations=False) + messages.success(request,'The selected positions have been set as NOT Accepting Nominations') + elif action == "set_accept_fb": + positions.update(accepting_feedback=True) + messages.success(request,'The selected positions have been set as Accepting Feedback') + elif action == "unset_accept_fb": + positions.update(accepting_feedback=False) + messages.success(request,'The selected positions have been set as NOT Accepting Feedback') + positions = nomcom.position_set.order_by('-is_open') + else: + messages.warning(request, "Please select some positions to work with") return render(request, 'nomcom/list_positions.html', {'positions': positions, diff --git a/ietf/templates/nomcom/edit_position.html b/ietf/templates/nomcom/edit_position.html index 3dfa62fe1c..fd01a2c4fa 100644 --- a/ietf/templates/nomcom/edit_position.html +++ b/ietf/templates/nomcom/edit_position.html @@ -31,5 +31,14 @@

{% if position %}Save{% else %}Add{% endif %} Back + {% if position.name %} +

+ Templates +

+ {% for template in position.get_templates %} + {{ template }} +
+ {% endfor %} + {% endif %} {% endblock %} -{% block content_end %}{{ form.media.js }}{% endblock %} \ No newline at end of file +{% block content_end %}{{ form.media.js }}{% endblock %} diff --git a/ietf/templates/nomcom/list_positions.html b/ietf/templates/nomcom/list_positions.html index e2affefb81..476dce967f 100644 --- a/ietf/templates/nomcom/list_positions.html +++ b/ietf/templates/nomcom/list_positions.html @@ -1,6 +1,6 @@ {% extends "nomcom/nomcom_private_base.html" %} {# Copyright The IETF Trust 2015, All Rights Reserved #} -{% load origin %} +{% load origin static %} {% block subtitle %}- Positions{% endblock %} {% block nomcom_content %} {% origin %} @@ -13,54 +13,129 @@

Positions in {{ nomcom.group }}

Configuration Hints.

{% endif %} + + {% if nomcom.group.state_id == 'active' %} +
+ {% csrf_token %} + {% endif %} {% if positions %} - {% regroup positions by is_open as posgroups %} - {% for group in posgroups %} -

{{ group.grouper| yesno:"Open Positions,Closed Positions" }}

- {% for position in group.list %} -

- {{ position.name }} - {% if position.is_iesg_position %}(IESG){% endif %} -

- {% if group.grouper %} -
-
- Accepting -
-
- {% if position.accepting_nominations %}Nominations{% endif %} - {% if position.accepting_nominations and position.accepting_feedback %}and{% endif %} - {% if position.accepting_feedback %}Feedback{% endif %} -
-
- {% endif %} -
-
- Templates -
-
- {% for template in position.get_templates %} - {{ template }} -
- {% endfor %} -
+ + + {% if nomcom.group.state_id == 'active' %} -
- Actions -
-
- Edit - Remove -
+ {% endif %} - - {% endfor %} - {% endfor %} + + + + + + + + + + {% for position in positions %} + + {% if nomcom.group.state_id == 'active' %} + + + + {% endif %} + + + + + + + {% endfor %} + +
+ + + Position + + IESG + + Open + + Accepting Nominations + + Accepting Feedback +
+ + + + Edit + + + + Remove + + + {{ position.name }} + + {{ position.is_iesg_position|yesno:"✓," }} + + {{ position.is_open|yesno:"✓," }} + + {{ position.accepting_nominations|yesno:"✓," }} + + {{ position.accepting_feedback|yesno:"✓," }} +
+ {% if nomcom.group.state_id == 'active' %} +
+ + +
+ + + {% endif %} {% else %}

There are no positions defined.

{% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} +{% block js %} + +{% endblock %}