From cd77c76372de5dcd67e5b1e62efe14e1d403d336 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Wed, 5 Feb 2020 21:10:47 +0000 Subject: [PATCH] Add links to user profiles from nominee list and feedback page. Fixes #2839. Commit ready for merge. - Legacy-Id: 17275 --- ietf/nomcom/tests.py | 50 +++++++++++++++++------- ietf/templates/nomcom/feedback.html | 7 +++- ietf/templates/nomcom/private_index.html | 12 ++++-- 3 files changed, 48 insertions(+), 21 deletions(-) diff --git a/ietf/nomcom/tests.py b/ietf/nomcom/tests.py index be45c0d94..e0fa03e4f 100644 --- a/ietf/nomcom/tests.py +++ b/ietf/nomcom/tests.py @@ -1,4 +1,4 @@ -# Copyright The IETF Trust 2012-2019, All Rights Reserved +# Copyright The IETF Trust 2012-2020, All Rights Reserved # -*- coding: utf-8 -*- @@ -124,22 +124,37 @@ class NomcomViewsTest(TestCase): def test_private_index_view(self): """Verify private home view""" self.access_member_url(self.private_index_url) + + # Verify that nominee table has links to person and feedback pages + nom_pos = self.create_nominee('accepted', COMMUNITY_USER, 'APP') + person_url = reverse('ietf.person.views.profile', + kwargs={'email_or_name': nom_pos.nominee.name()}) + feedback_url = reverse('ietf.nomcom.views.view_feedback_nominee', + kwargs={'year': self.year, 'nominee_id': nom_pos.nominee.pk}) + + # With a single nominee, the first row will have our data. + # Require that the row have at least one link to the person URL + # and one to the feedback URL. + response = self.client.get(self.private_index_url) + q = PyQuery(response.content) + row_q = q('#nominee-position-table tbody tr').eq(0) + self.assertTrue(row_q('a[href="%s"]' % (person_url)), + 'Nominee table does not link to nominee profile page') + self.assertTrue(row_q('a[href="%s#comment"]' % (feedback_url)), + 'Nominee table does not link to nominee feedback page') self.client.logout() + def create_nominee(self, base_state, username, pos_name): + cnominee = Nominee.objects.get(email__person__user__username=username) + position = Position.objects.get(name=pos_name) + return NomineePosition.objects.create(position=position, + nominee=cnominee, + state=NomineePositionStateName.objects.get(slug=base_state)) + def create_nominees_for_states(self, base_state): - cnominee = Nominee.objects.get(email__person__user__username=COMMUNITY_USER) - position = Position.objects.get(name='APP') - nom_pos = NomineePosition.objects.create(position=position, - nominee=cnominee, - state=NomineePositionStateName.objects.get(slug=base_state)) - position = Position.objects.get(name='INT') - NomineePosition.objects.create(position=position, - nominee=cnominee, - state=NomineePositionStateName.objects.get(slug=base_state)) - position = Position.objects.get(name='OAM') - NomineePosition.objects.create(position=position, - nominee=cnominee, - state=NomineePositionStateName.objects.get(slug=base_state)) + nom_pos = self.create_nominee(base_state, COMMUNITY_USER, 'APP') + self.create_nominee(base_state, COMMUNITY_USER, 'INT') + self.create_nominee(base_state, COMMUNITY_USER, 'OAM') return nom_pos def test_private_index_post_accept(self): @@ -872,7 +887,12 @@ class NomcomViewsTest(TestCase): response = self.client.get(feedback_url) self.assertEqual(response.status_code, 200) self.assertContains(response, "feedbackform") - + # Test for a link to the nominee's profile page + q = PyQuery(response.content) + person_url = reverse('ietf.person.views.profile', kwargs={'email_or_name': nominee.name()}) + self.assertTrue(q('a[href="%s"]' % (person_url)), + 'Nominee feedback page does not link to profile page') + comments = 'Test feedback view. Comments with accents äöåÄÖÅ éáíóú âêîôû ü àèìòù.' test_data = {'comment_text': comments, diff --git a/ietf/templates/nomcom/feedback.html b/ietf/templates/nomcom/feedback.html index 25fd61f74..449472346 100644 --- a/ietf/templates/nomcom/feedback.html +++ b/ietf/templates/nomcom/feedback.html @@ -1,5 +1,5 @@ {% extends base_template %} -{# Copyright The IETF Trust 2015, All Rights Reserved #} +{# Copyright The IETF Trust 2015-2020, All Rights Reserved #} {% load origin %} {% load bootstrap3 %} @@ -91,7 +91,10 @@
{% if form %} {% if form.position %} -

Provide feedback about {{form.nominee.email.person.name}} ({{form.nominee.email.address}}) for the {{form.position.name}} position. +

Provide feedback 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 %} {% endif %} diff --git a/ietf/templates/nomcom/private_index.html b/ietf/templates/nomcom/private_index.html index 3226f0d93..7cd8def8b 100644 --- a/ietf/templates/nomcom/private_index.html +++ b/ietf/templates/nomcom/private_index.html @@ -1,5 +1,5 @@ {% extends "nomcom/nomcom_private_base.html" %} -{# Copyright The IETF Trust 2015, All Rights Reserved #} +{# Copyright The IETF Trust 2015-2020, All Rights Reserved #} {% load origin static %} {% block subtitle %} - Administration {% endblock %} @@ -116,11 +116,12 @@ {% endif %} - +
{% if is_chair and nomcom.group.state_id == 'active' %}{% endif %} - + @@ -135,7 +136,10 @@ {% endif %} +
NomineeNominee Position State Questionnaire response - {{ np.nominee }} + {{ np.nominee }} + + View feedback {{ np.position.name }} {{ np.state }}