Skip to content

Commit c49abdd

Browse files
committed
Allow nomcoms to configure the feedback page to show nominee pictures. Fixes ietf-tools#2252. Commit ready for merge,
- Legacy-Id: 13413
1 parent ffa49a6 commit c49abdd

5 files changed

Lines changed: 70 additions & 2 deletions

File tree

ietf/nomcom/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def __init__(self, *args, **kwargs):
210210

211211
class Meta:
212212
model = NomCom
213-
fields = ('public_key', 'initial_text',
213+
fields = ('public_key', 'initial_text', 'show_nominee_pictures',
214214
'send_questionnaire', 'reminder_interval')
215215

216216
def clean_public_key(self):
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.10.7 on 2017-05-23 12:18
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('nomcom', '0014_alter_is_open_help_text'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='nomcom',
17+
name='show_nominee_pictures',
18+
field=models.BooleanField(default=True, help_text=b'Display pictures of each nominee (if available) on the feedback pages', verbose_name=b'Show nominee pictures'),
19+
),
20+
]

ietf/nomcom/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class NomCom(models.Model):
4646
blank=True, null=True)
4747
initial_text = models.TextField(verbose_name='Help text for nomination form',
4848
blank=True)
49+
show_nominee_pictures = models.BooleanField(verbose_name='Show nominee pictures', default=True,
50+
help_text='Display pictures of each nominee (if available) on the feedback pages')
4951

5052
class Meta:
5153
verbose_name_plural = 'NomComs'

ietf/nomcom/tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,3 +1861,23 @@ def test_private_accepting_feedback(self):
18611861
self.assertEqual( len(q('.badge')) , 3 )
18621862

18631863

1864+
class FeedbackPictureTests(TestCase):
1865+
def setUp(self):
1866+
build_test_public_keys_dir(self)
1867+
self.nc = NomComFactory(**nomcom_kwargs_for_year())
1868+
self.plain_person = PersonFactory.create()
1869+
1870+
def tearDown(self):
1871+
clean_test_public_keys_dir(self)
1872+
1873+
def test_feedback_pictures(self):
1874+
url = reverse('ietf.nomcom.views.public_feedback',kwargs={'year':self.nc.year()})
1875+
login_testing_unauthorized(self,self.plain_person.user.username,url)
1876+
response = self.client.get(url)
1877+
q = PyQuery(response.content)
1878+
self.assertTrue(q('.photo'))
1879+
self.nc.show_nominee_pictures=False;
1880+
self.nc.save()
1881+
response = self.client.get(url)
1882+
q = PyQuery(response.content)
1883+
self.assertFalse(q('.photo'))

ietf/templates/nomcom/feedback.html

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,27 @@
1212
.btn-group-vertical .btn .badge {
1313
float:right;
1414
margin-top: 0.15em;
15+
margin-right: 0.15em;
1516
}
17+
.btn-group-vertical .btn .photo {
18+
display: inline-block;
19+
min-width: 15px;
20+
float:right;
21+
}
22+
.feedbackphoto {
23+
display: inline-block;
24+
float:right;
25+
margin-bottom: 0.15em;
26+
margin-left: 0.15em;
27+
}
28+
1629
@-moz-document url-prefix() {
1730
.btn-group-vertical .btn .badge {
1831
margin-top: -1.3em;
1932
}
33+
.btn-group-vertical .btn .photo {
34+
margin-top: -1.5em;
35+
}
2036
}
2137

2238
{% endblock %}
@@ -46,6 +62,13 @@ <h4>{{ p.name }}</h4>
4662
<a class="btn btn-default btn-xs" {% if nomcom.group.state_id != 'conclude' %}href="?nominee={{np.nominee.id}}&position={{ np.position.id}}"{% endif %}>
4763
{{ np.nominee.name }}
4864
{% with count=counts|lookup:np.position.id|lookup:np.nominee.id %}
65+
{% if nomcom.show_nominee_pictures %}
66+
{% if np.nominee.person.photo_thumb %}
67+
<span class="photo"><img src="{{np.nominee.person.photo_thumb.url}}" width=15 height=15/></span>
68+
{% else %}
69+
<span class="photo">&nbsp;</span>
70+
{% endif %}
71+
{% endif %}
4972
<span class="badge"
5073
title="{% if count %}{{count}} earlier comment{{count|pluralize}} from you {% else %}You have not yet provided feedback {% endif %} on {{np.nominee.email.address}} as {{np.position}}">
5174
{{ count | default:"no feedback" }}
@@ -70,7 +93,10 @@ <h4>{{ p.name }}</h4>
7093
{% if form %}
7194
<h3>Provide feedback
7295
{% if form.position %}
73-
about {{form.nominee.email.person.name}} ({{form.nominee.email.address}}) for the {{form.position.name}} position.</p>
96+
about {{form.nominee.email.person.name}} ({{form.nominee.email.address}}) for the {{form.position.name}} position.
97+
{% if nomcom.show_nominee_pictures and form.nominee.email.person.photo_thumb %}
98+
<span class="feedbackphoto"><img src="{{form.nominee.email.person.photo_thumb.url}}" width=100 /></span>
99+
{% endif %}
74100
{% endif %}
75101
</h3>
76102
<p>This feedback will only be available to <a href="{% url 'ietf.nomcom.views.year_index' year=year %}">NomCom {{year}}</a>.

0 commit comments

Comments
 (0)