Merged in [17557] from fenton@bluepopcorn.net:

Provide more consistent links to people pages. Fixes #2918.
 - Legacy-Id: 17561
Note: SVN reference [17557] has been migrated to Git commit b9c5152714
This commit is contained in:
Henrik Levkowetz 2020-03-30 20:07:25 +00:00
commit 7084e6e662
6 changed files with 46 additions and 14 deletions

View file

@ -1,5 +1,7 @@
from django import template
import debug # pyflakes:ignore
from ietf.group.models import Group
register = template.Library()
@ -25,3 +27,12 @@ def active_nomcoms(user):
state__slug='active').distinct().select_related("type"))
return groups
@register.inclusion_tag('person/person_link.html')
def role_person_link(role, **kwargs):
title = kwargs.get('title', '')
cls = kwargs.get('class', '')
name = role.person.name
plain_name = role.person.plain_name()
email = role.email.address
return {'name': name, 'plain_name': plain_name, 'email': email, 'title': title, 'class': cls}

View file

@ -23,3 +23,21 @@ def person_by_name(name):
alias = Alias.objects.filter(name=name).first()
return alias.person if alias else None
@register.inclusion_tag('person/person_link.html')
def person_link(person, **kwargs):
title = kwargs.get('title', '')
cls = kwargs.get('class', '')
name = person.name
plain_name = person.plain_name()
email = person.email_address()
return {'name': name, 'plain_name': plain_name, 'email': email, 'title': title, 'class': cls}
@register.inclusion_tag('person/person_link.html')
def email_person_link(email, **kwargs):
title = kwargs.get('title', '')
cls = kwargs.get('class', '')
name = email.person.name
plain_name = email.person.plain_name()
email = email.address
return {'name': name, 'plain_name': plain_name, 'email': email, 'title': title, 'class': cls}

View file

@ -2,6 +2,7 @@
{% load widget_tweaks %}
{% load ietf_filters %}
{% load ballot_icon %}
{% load person_filters %}
<tr {% spaceless %}
{% if color_row_positions %}
@ -120,9 +121,9 @@
{% if ad_name == None or ad_name != doc.ad.plain_name %}
<td class="area-director">
{% if doc.ad %}
<a title="Area Director" href="mailto:{{ doc.ad.email_address|urlencode }}">{{ doc.ad }}</a><br>
{% person_link doc.ad title="Area Director" %}<br>
{% endif %}
{% if doc.shepherd %}<a title="Shepherd" href="mailto:{{doc.shepherd}}"><small class="text-muted">{{doc.shepherd.person.name}}</small></a>{% endif %}
{% if doc.shepherd %}{% email_person_link doc.shepherd title="Shepherd" class="small text-muted" %}{% endif %}
</td>
{% endif %}

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin staticfiles %}
{% load origin staticfiles group_filters %}
{% block pagehead %}
<link rel="stylesheet" href="{% static "jquery.tablesorter/css/theme.bootstrap.min.css" %}">
@ -69,11 +69,9 @@
</td>
<td>{{ group.name }}</td>
<td>
{% for chair in group.chairs %}
<a href="{% url 'ietf.person.views.profile' email_or_name=chair.person.name %}">{{ chair.person.plain_name }}</a>
<a href="mailto:{{ chair.email.address }}"><span class="fa fa-envelope-o tiny"></span></a>{% if not forloop.last %} , {% endif %}
{% endfor %}
{% if group.ad_out_of_area %}(Assigned AD: <a href="mailto:{{ group.ad_role.email.address }}">{{ group.ad_role.person.plain_name }}</a>){% endif %}
{% for chair in group.chairs %}{% role_person_link chair %}{% if not forloop.last %} , {% endif %}
{% endfor %}
{% if group.ad_out_of_area %}(Assigned AD: {% role_person_link group.ad_role %}){% endif %}
</td>
</tr>
{% endfor %}

View file

@ -3,7 +3,7 @@
{% load origin %}
{% load ietf_filters %}
{% load markup_tags %}
{% load textfilters %}
{% load textfilters group_filters %}
{% block group_content %}
{% origin %}
@ -155,11 +155,8 @@
{% endif %}
</td>
<td>
{% for r in roles %}
<span class="fa fa-envelope-o"></span>
<a href="mailto:{{ r.email.address }}">{{ r.person.plain_name }}</a>
{% role_person_link r %}
<br>
{% endfor %}
</td>

View file

@ -0,0 +1,7 @@
{# Copyright The IETF Trust 2020, All Rights Reserved #}{% spaceless %}
<a {% if title %}title="{{ title }}"{% endif %} href="{% url 'ietf.person.views.profile' email_or_name=name %}">
<span class="{{class}}">{{ plain_name }}</span>
</a>&nbsp;<a href="mailto:{{ email|urlencode }}">
<span class="fa fa-envelope-o tiny"></span>
</a>
{% endspaceless %}