summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-10-18 15:36:56 -0500
committerDan McGee <dan@archlinux.org>2014-10-18 15:36:56 -0500
commit122302e9e5fb9752a942abe5691ad3dd6d186196 (patch)
tree7b7ac68ef68d52808b9d48b0eddf88c89612d00a
parente5e5632fb3432e153d0677b4bf145bc2eb72ef65 (diff)
Move maintainer/packager link code back into template
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/templatetags/jinja2.py26
-rw-r--r--templates/packages/details.html.jinja14
2 files changed, 8 insertions, 32 deletions
diff --git a/packages/templatetags/jinja2.py b/packages/templatetags/jinja2.py
index 263fc156..22f9914b 100644
--- a/packages/templatetags/jinja2.py
+++ b/packages/templatetags/jinja2.py
@@ -25,32 +25,6 @@ def link_encode(url, query):
@library.global_function
-def maintainer_link(user):
- if user:
- # TODO don't hardcode
- title = escape('View packages maintained by ' + user.get_full_name())
- return '<a href="/packages/?maintainer=%s" title="%s">%s</a>' % (
- user.username,
- title,
- user.get_full_name(),
- )
- return ''
-
-
-@library.global_function
-def packager_link(user):
- if user:
- # TODO don't hardcode
- title = escape('View packages packaged by ' + user.get_full_name())
- return '<a href="/packages/?packager=%s" title="%s">%s</a>' % (
- user.username,
- title,
- user.get_full_name(),
- )
- return ''
-
-
-@library.global_function
def pgp_key_link(key_id, link_text=None):
return pgp.pgp_key_link(key_id, link_text)
diff --git a/templates/packages/details.html.jinja b/templates/packages/details.html.jinja
index 7ca5629c..52d13f14 100644
--- a/templates/packages/details.html.jinja
+++ b/templates/packages/details.html.jinja
@@ -149,11 +149,10 @@
<tr>
<th>Maintainers:</th>
{% with maints = pkg.maintainers %}
- <td>{% if maints %}
- {% for m in maints %}
- {{ maintainer_link(m)|safe }}<br/>
- {% endfor %}
- {% else %}Orphan{% endif %}
+ <td>{% if maints %}{% for m in maints %}
+ <a href="/packages/?maintainer={{ m.username }}"
+ title="View packages maintained by {{ m.get_full_name() }}">{{ m.get_full_name() }}</a><br/>
+ {% endfor %}{% else %}Orphan{% endif %}
</td>
{% endwith %}
</tr><tr>
@@ -164,7 +163,10 @@
<td>{{ pkg.installed_size|filesizeformat }}</td>
</tr><tr>
<th>Last Packager:</th>
- <td>{% with pkgr = pkg.packager %}{% if pkgr %}{{ packager_link(pkgr)|safe }}{% else %}{{ pkg.packager_str }}{% endif %}{% endwith %}</td>
+ <td>{% with pkgr = pkg.packager %}{% if pkgr %}
+ <a href="/packages/?packager={{ pkgr.username }}"
+ title="View packages packaged by {{ pkgr.get_full_name() }}">{{ pkgr.get_full_name() }}</a>
+ {% else %}{{ pkg.packager_str }}{% endif %}{% endwith %}</td>
</tr><tr>
<th>Build Date:</th>
<td>{{ pkg.build_date|date("DATETIME_FORMAT") }} UTC</td>