Skip to content

Commit

Permalink
Added Closing Notes to history and about pages for groups. Fixes issue
Browse files Browse the repository at this point in the history
…#2725. Commit ready for merge.

 - Legacy-Id: 16559
  • Loading branch information
jimfenton committed Jul 20, 2019
1 parent c3ffd09 commit 93b4d6f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ietf/group/forms.py
Expand Up @@ -57,7 +57,8 @@ def clean(self):
raise forms.ValidationError("NULL TXT file input is not a valid option")

class ConcludeGroupForm(forms.Form):
instructions = forms.CharField(widget=forms.Textarea(attrs={'rows': 30}), required=True, strip=False)
instructions = forms.CharField(widget=forms.Textarea(attrs={'rows': 15}), required=True, strip=False)
closing_note = forms.CharField(widget=forms.Textarea(attrs={'rows': 5}), label='Closing note, for WG history (optional)', required=False, strip=False)

class GroupForm(forms.Form):
name = forms.CharField(max_length=80, label="Name", required=True)
Expand All @@ -78,6 +79,7 @@ class GroupForm(forms.Form):
list_subscribe = forms.CharField(max_length=255, required=False)
list_archive = forms.CharField(max_length=255, required=False)
urls = forms.CharField(widget=forms.Textarea, label="Additional URLs", help_text="Format: https://site/path (Optional description). Separate multiple entries with newline. Prefer HTTPS URLs where possible.", required=False)
closing_note = forms.CharField(widget=forms.Textarea, label="Closing note", required=False)

def __init__(self, *args, **kwargs):
self.group = kwargs.pop('group', None)
Expand Down
38 changes: 38 additions & 0 deletions ietf/group/views.py
Expand Up @@ -523,6 +523,10 @@ def group_about(request, acronym, group_type=None):
e = group.latest_event(type__in=("changed_state", "requested_close",))
requested_close = group.state_id != "conclude" and e and e.type == "requested_close"

e = None
if group.state_id == "conclude":
e = group.latest_event(type='closing_note')

can_manage = can_manage_group_type(request.user, group)
charter_submit_url = ""
if group.features.has_chartering_process:
Expand All @@ -542,6 +546,7 @@ def group_about(request, acronym, group_type=None):
"status_update": status_update,
"charter_submit_url": charter_submit_url,
"editable_roles": roles_for_group_type(group_type),
"closing_note": e,
}))

def all_status(request):
Expand Down Expand Up @@ -1000,13 +1005,36 @@ def diff(attr, name):

group.save()

#Handle changes to Closing Note, if any. It's an event, not a group attribute like the others
closing_note = ""
e = group.latest_event(type='closing_note')
if e:
closing_note = e.desc

if closing_note != clean["closing_note"]:
closing_note = clean["closing_note"]
e = GroupEvent(group=group, by=request.user.person)
e.type = "closing_note"
if closing_note == "":
e.desc = "(Closing note deleted)" #Flag value so something shows up in history
else:
e.desc = closing_note
e.save()

if action=="charter":
return redirect('ietf.doc.views_charter.submit', name=charter_name_for_group(group), option="initcharter")

return HttpResponseRedirect(group.about_url())
else: # Not POST:
if not new_group:
ad_role = group.ad_role()
closing_note = ""
e = group.latest_event(type='closing_note')
if e:
closing_note = e.desc
if closing_note == "(Closing note deleted)":
closing_note = ""

init = dict(name=group.name,
acronym=group.acronym,
state=group.state,
Expand All @@ -1016,6 +1044,7 @@ def diff(attr, name):
list_subscribe=group.list_subscribe if group.list_subscribe else None,
list_archive=group.list_archive if group.list_archive else None,
urls=format_urls(group.groupurl_set.all()),
closing_note = closing_note,
)

for slug in roles_for_group_type(group_type):
Expand All @@ -1042,14 +1071,23 @@ def conclude(request, acronym, group_type=None):
form = ConcludeGroupForm(request.POST)
if form.is_valid():
instructions = form.cleaned_data['instructions']
closing_note = form.cleaned_data['closing_note']

if closing_note != "":
instructions = instructions+"\n\n=====\nClosing note:\n\n"+closing_note
email_admin_re_charter(request, group, "Request closing of group", instructions, 'group_closure_requested')

e = GroupEvent(group=group, by=request.user.person)
e.type = "requested_close"
e.desc = "Requested closing group"
e.save()

if closing_note != "":
e = GroupEvent(group=group, by=request.user.person)
e.type = "closing_note"
e.desc = closing_note
e.save()

kwargs = {'acronym':group.acronym}
if group_type:
kwargs['group_type'] = group_type
Expand Down
5 changes: 5 additions & 0 deletions ietf/templates/group/group_about.html
Expand Up @@ -221,6 +221,11 @@
{% endif %}
</table>

{% if closing_note and closing_note.desc != "(Closing note deleted)" %}
<h2>Closing note for {{ group.type.desc.title }}</h2>
{{ closing_note.desc }}
{% endif %}

{% if group.features.has_chartering_process %}
<h2>Charter for {% if group.state_id == "proposed" %}proposed{% endif %} {{ group.type.desc.title }}</h2>
{# the linebreaks filter adds <p/>, no surrounding <p/> necessary: #}
Expand Down

0 comments on commit 93b4d6f

Please sign in to comment.