From adb2a2ff7a0bdc06b6fce2014a71dcd8cb621625 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Fri, 26 Mar 2021 14:59:46 +0100 Subject: [PATCH] Make anonymized voting results and events visible to voting Fellows --- colleges/forms.py | 6 +++ .../colleges/_potentialfellowship_card.html | 47 +++++++++++-------- .../_potentialfellowship_event_li.html | 2 +- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/colleges/forms.py b/colleges/forms.py index cac2b6b69..117b61652 100644 --- a/colleges/forms.py +++ b/colleges/forms.py @@ -262,3 +262,9 @@ class PotentialFellowshipEventForm(forms.ModelForm): class Meta: model = PotentialFellowshipEvent fields = ['event', 'comments'] + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields['comments'].widget.attrs.update({ + 'placeholder': 'NOTA BENE: careful, will be visible to all who have voting rights' + }) diff --git a/colleges/templates/colleges/_potentialfellowship_card.html b/colleges/templates/colleges/_potentialfellowship_card.html index 4023dafe1..ba53f80dc 100644 --- a/colleges/templates/colleges/_potentialfellowship_card.html +++ b/colleges/templates/colleges/_potentialfellowship_card.html @@ -1,8 +1,12 @@ {% load bootstrap %} {% load scipost_extras %} +{% load user_groups %} {% load colleges_extras %} +{% is_scipost_admin request.user as is_scipost_admin %} +{% is_ed_admin request.user as is_ed_admin %} + <div class="card-body"> <div class="row"> <div class="col-12"> @@ -54,18 +58,20 @@ </div> {% endif %} - {% if perms.scipost.can_manage_college_composition %} - <h3 class="highlight">Voting results</h3> - <div class="row"> + <h3 class="highlight">Voting results</h3> + <div class="row"> + {% if perms.scipost.can_manage_college_composition %} <div class="col-6"> <p> Voting Fellows' matching expertises are marked in <span class="px-1 bg-success">green</span>. </p> </div> - <div class="col-6"> - {% voting_results_display potfel %} - </div> + {% endif %} + <div class="col-6"> + {% voting_results_display potfel %} </div> + </div> + {% if perms.scipost.can_manage_college_composition %} <div class="row"> <div class="col-4"> <table class="table"> @@ -118,19 +124,19 @@ </div> {% endif %} - {% if perms.scipost.can_manage_college_composition %} - <h3 class="highlight">Events</h3> - <div class="row"> - <div class="col-md-6"> - <ul> - {% for event in potfel.potentialfellowshipevent_set.all %} - {% include 'colleges/_potentialfellowship_event_li.html' with event=event %} - {% empty %} - <li>No events found.</li> - {% endfor %} - </ul> - </div> + <h3 class="highlight">Events</h3> + <div class="row"> + <div class="col-md-6"> + <ul> + {% for event in potfel.potentialfellowshipevent_set.all %} + {% include 'colleges/_potentialfellowship_event_li.html' with event=event %} + {% empty %} + <li>No events found.</li> + {% endfor %} + </ul> + </div> + {% if perms.scipost.can_manage_college_composition %} <div class="col-md-6"> <h3>Add an event for this Potential Fellowship</h3> <form class="d-block mt-2 mb-3" action="{% url 'colleges:potential_fellowship_event_create' pk=potfel.id %}" method="post"> @@ -139,6 +145,7 @@ <input type="submit" name="submit" value="Submit" class="btn btn-primary"> </form> </div> - </div> - {% endif %} + {% endif %} + </div> + </div> diff --git a/colleges/templates/colleges/_potentialfellowship_event_li.html b/colleges/templates/colleges/_potentialfellowship_event_li.html index 38fb55bf4..44a025a03 100644 --- a/colleges/templates/colleges/_potentialfellowship_event_li.html +++ b/colleges/templates/colleges/_potentialfellowship_event_li.html @@ -1,5 +1,5 @@ <li id="{{ event.id }}"> - <div class="font-weight-bold">{{ event.get_event_display }} <small class="text-muted">noted {{ event.noted_on }} {% if event.noted_by %}by {{ event.noted_by }}{% endif %}</small></div> + <div class="font-weight-bold">{{ event.get_event_display }} <small class="text-muted">noted {{ event.noted_on }} {% if perms.scipost.can_manage_college_composition and event.noted_by %}by {{ event.noted_by }}{% endif %}</small></div> {% if event.comments %} <div>{{ event.comments|linebreaks }}</div> {% endif %} -- GitLab