Allow nomcoms to configure the feedback page to show nominee pictures. Fixes #2252. Commit ready for merge,
- Legacy-Id: 13413
This commit is contained in:
parent
ffa49a68fd
commit
c49abdd557
|
@ -210,7 +210,7 @@ class EditNomcomForm(forms.ModelForm):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = NomCom
|
model = NomCom
|
||||||
fields = ('public_key', 'initial_text',
|
fields = ('public_key', 'initial_text', 'show_nominee_pictures',
|
||||||
'send_questionnaire', 'reminder_interval')
|
'send_questionnaire', 'reminder_interval')
|
||||||
|
|
||||||
def clean_public_key(self):
|
def clean_public_key(self):
|
||||||
|
|
20
ietf/nomcom/migrations/0015_show_pictures.py
Normal file
20
ietf/nomcom/migrations/0015_show_pictures.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.7 on 2017-05-23 12:18
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('nomcom', '0014_alter_is_open_help_text'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='nomcom',
|
||||||
|
name='show_nominee_pictures',
|
||||||
|
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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -46,6 +46,8 @@ class NomCom(models.Model):
|
||||||
blank=True, null=True)
|
blank=True, null=True)
|
||||||
initial_text = models.TextField(verbose_name='Help text for nomination form',
|
initial_text = models.TextField(verbose_name='Help text for nomination form',
|
||||||
blank=True)
|
blank=True)
|
||||||
|
show_nominee_pictures = models.BooleanField(verbose_name='Show nominee pictures', default=True,
|
||||||
|
help_text='Display pictures of each nominee (if available) on the feedback pages')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name_plural = 'NomComs'
|
verbose_name_plural = 'NomComs'
|
||||||
|
|
|
@ -1861,3 +1861,23 @@ class AcceptingTests(TestCase):
|
||||||
self.assertEqual( len(q('.badge')) , 3 )
|
self.assertEqual( len(q('.badge')) , 3 )
|
||||||
|
|
||||||
|
|
||||||
|
class FeedbackPictureTests(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
build_test_public_keys_dir(self)
|
||||||
|
self.nc = NomComFactory(**nomcom_kwargs_for_year())
|
||||||
|
self.plain_person = PersonFactory.create()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
clean_test_public_keys_dir(self)
|
||||||
|
|
||||||
|
def test_feedback_pictures(self):
|
||||||
|
url = reverse('ietf.nomcom.views.public_feedback',kwargs={'year':self.nc.year()})
|
||||||
|
login_testing_unauthorized(self,self.plain_person.user.username,url)
|
||||||
|
response = self.client.get(url)
|
||||||
|
q = PyQuery(response.content)
|
||||||
|
self.assertTrue(q('.photo'))
|
||||||
|
self.nc.show_nominee_pictures=False;
|
||||||
|
self.nc.save()
|
||||||
|
response = self.client.get(url)
|
||||||
|
q = PyQuery(response.content)
|
||||||
|
self.assertFalse(q('.photo'))
|
||||||
|
|
|
@ -12,11 +12,27 @@
|
||||||
.btn-group-vertical .btn .badge {
|
.btn-group-vertical .btn .badge {
|
||||||
float:right;
|
float:right;
|
||||||
margin-top: 0.15em;
|
margin-top: 0.15em;
|
||||||
|
margin-right: 0.15em;
|
||||||
}
|
}
|
||||||
|
.btn-group-vertical .btn .photo {
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 15px;
|
||||||
|
float:right;
|
||||||
|
}
|
||||||
|
.feedbackphoto {
|
||||||
|
display: inline-block;
|
||||||
|
float:right;
|
||||||
|
margin-bottom: 0.15em;
|
||||||
|
margin-left: 0.15em;
|
||||||
|
}
|
||||||
|
|
||||||
@-moz-document url-prefix() {
|
@-moz-document url-prefix() {
|
||||||
.btn-group-vertical .btn .badge {
|
.btn-group-vertical .btn .badge {
|
||||||
margin-top: -1.3em;
|
margin-top: -1.3em;
|
||||||
}
|
}
|
||||||
|
.btn-group-vertical .btn .photo {
|
||||||
|
margin-top: -1.5em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -46,6 +62,13 @@
|
||||||
<a class="btn btn-default btn-xs" {% if nomcom.group.state_id != 'conclude' %}href="?nominee={{np.nominee.id}}&position={{ np.position.id}}"{% endif %}>
|
<a class="btn btn-default btn-xs" {% if nomcom.group.state_id != 'conclude' %}href="?nominee={{np.nominee.id}}&position={{ np.position.id}}"{% endif %}>
|
||||||
{{ np.nominee.name }}
|
{{ np.nominee.name }}
|
||||||
{% with count=counts|lookup:np.position.id|lookup:np.nominee.id %}
|
{% with count=counts|lookup:np.position.id|lookup:np.nominee.id %}
|
||||||
|
{% if nomcom.show_nominee_pictures %}
|
||||||
|
{% if np.nominee.person.photo_thumb %}
|
||||||
|
<span class="photo"><img src="{{np.nominee.person.photo_thumb.url}}" width=15 height=15/></span>
|
||||||
|
{% else %}
|
||||||
|
<span class="photo"> </span>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
<span class="badge"
|
<span class="badge"
|
||||||
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}}">
|
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}}">
|
||||||
{{ count | default:"no feedback" }}
|
{{ count | default:"no feedback" }}
|
||||||
|
@ -70,7 +93,10 @@
|
||||||
{% if form %}
|
{% if form %}
|
||||||
<h3>Provide feedback
|
<h3>Provide feedback
|
||||||
{% if form.position %}
|
{% if form.position %}
|
||||||
about {{form.nominee.email.person.name}} ({{form.nominee.email.address}}) for the {{form.position.name}} position.</p>
|
about {{form.nominee.email.person.name}} ({{form.nominee.email.address}}) for the {{form.position.name}} position.
|
||||||
|
{% if nomcom.show_nominee_pictures and form.nominee.email.person.photo_thumb %}
|
||||||
|
<span class="feedbackphoto"><img src="{{form.nominee.email.person.photo_thumb.url}}" width=100 /></span>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h3>
|
</h3>
|
||||||
<p>This feedback will only be available to <a href="{% url 'ietf.nomcom.views.year_index' year=year %}">NomCom {{year}}</a>.
|
<p>This feedback will only be available to <a href="{% url 'ietf.nomcom.views.year_index' year=year %}">NomCom {{year}}</a>.
|
||||||
|
|
Loading…
Reference in a new issue