Add links to user profiles from nominee list and feedback page. Fixes #2839. Commit ready for merge.

- Legacy-Id: 17275
This commit is contained in:
Jennifer Richards 2020-02-05 21:10:47 +00:00
parent c628678fc9
commit cd77c76372
3 changed files with 48 additions and 21 deletions

View file

@ -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,

View file

@ -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 @@
<div class="col-sm-8 col-sm-pull-4">
{% if form %}
{% if form.position %}
<h3> Provide feedback about {{form.nominee.email.person.name}} ({{form.nominee.email.address}}) for the {{form.position.name}} position.
<h3> Provide feedback about
<a href="{% url 'ietf.person.views.profile' email_or_name=form.nominee.name %}">
{{form.nominee.email.person.name}}
</a> ({{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 %}

View file

@ -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 %}
<table class="table table-condensed table-striped table-hover tablesorter">
<table class="table table-condensed table-striped table-hover tablesorter"
id="nominee-position-table">
<thead>
<tr>
{% if is_chair and nomcom.group.state_id == 'active' %}<th colspan="2"><span class="fa fa-check"></span></th>{% endif %}
<th>Nominee</th>
<th colspan="2">Nominee</th>
<th>Position</th>
<th>State</th>
<th>Questionnaire response</th>
@ -135,7 +136,10 @@
{% endif %}
<td>
<a href="{% url 'ietf.nomcom.views.view_feedback_nominee' year=year nominee_id=np.nominee.id %}#comment">{{ np.nominee }}</a>
<a href="{% url 'ietf.person.views.profile' email_or_name=np.nominee.name %}">{{ np.nominee }}</a>
</td>
<td>
<a href="{% url 'ietf.nomcom.views.view_feedback_nominee' year=year nominee_id=np.nominee.id %}#comment">View feedback</a>
</td>
<td>{{ np.position.name }}</td>
<td>{{ np.state }}</td>