diff options
-rw-r--r-- | templates/devel/index.html | 3 | ||||
-rw-r--r-- | templates/todolists/public_list.html | 4 | ||||
-rw-r--r-- | templates/todolists/view.html | 4 | ||||
-rw-r--r-- | todolists/templatetags/__init__.py | 0 | ||||
-rw-r--r-- | todolists/templatetags/todolists.py | 19 |
5 files changed, 25 insertions, 5 deletions
diff --git a/templates/devel/index.html b/templates/devel/index.html index 5715104..6d30440 100644 --- a/templates/devel/index.html +++ b/templates/devel/index.html @@ -2,6 +2,7 @@ {% load static from staticfiles %} {% load cache %} {% load package_extras %} +{% load todolists %} {% block title %}Arch Linux - Developer Dashboard{% endblock %} @@ -61,7 +62,7 @@ <tr class="{% cycle 'odd' 'even' %}"> <td><a href="{{ todopkg.todolist.get_absolute_url }}" title="View todo list: {{ todopkg.todolist.name }}">{{ todopkg.todolist.name }}</a></td> - <td>{% pkg_details_link todopkg.pkg %}</td> + <td>{% todopkg_details_link todopkg %}</td> <td>{{ todopkg.repo.name }}</td> <td>{{ todopkg.arch.name }}</td> <td>{{ todopkg.pkg.maintainers|join:', ' }}</td> diff --git a/templates/todolists/public_list.html b/templates/todolists/public_list.html index 41caf5b..da99bc0 100644 --- a/templates/todolists/public_list.html +++ b/templates/todolists/public_list.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load static from staticfiles %} -{% load package_extras %} +{% load todolists %} {% block title %}Arch Linux - Todo Lists{% endblock %} @@ -45,7 +45,7 @@ <tbody> {% for pkg in list.packages %} <tr class="{% cycle 'odd' 'even' %}"> - <td>{% pkg_details_link pkg.pkg pkg.pkgname %}</td> + <td>{% todopkg_details_link pkg %}</td> <td>{{ pkg.arch.name }}</td> <td>{{ pkg.repo.name|capfirst }}</td> <td>{{ pkg.maintainers|join:', ' }}</td> diff --git a/templates/todolists/view.html b/templates/todolists/view.html index 66bbec6..89a0512 100644 --- a/templates/todolists/view.html +++ b/templates/todolists/view.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% load static from staticfiles %} -{% load package_extras %} +{% load todolists %} {% block title %}Arch Linux - Todo: {{ list.name }}{% endblock %} @@ -71,7 +71,7 @@ <tr class="{% cycle 'odd' 'even' %}{% if user in pkg.maintainers %} mine{% endif %} {{ pkg.arch.name }} {{ pkg.repo.name|lower }}"> <td>{{ pkg.arch.name }}</td> <td>{{ pkg.repo.name|capfirst }}</td> - <td>{% pkg_details_link pkg.pkg pkg.pkgname %}</td> + <td>{% todopkg_details_link pkg %}</td> {% if pkg.pkg.flag_date %} <td><span class="flagged">{{ pkg.pkg.full_version }}</span></td> {% else %} diff --git a/todolists/templatetags/__init__.py b/todolists/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/todolists/templatetags/__init__.py diff --git a/todolists/templatetags/todolists.py b/todolists/templatetags/todolists.py new file mode 100644 index 0000000..5f31dc1 --- /dev/null +++ b/todolists/templatetags/todolists.py @@ -0,0 +1,19 @@ +from django import template + +register = template.Library() + + +def pkg_absolute_url(repo, arch, pkgname): + return '/packages/%s/%s/%s/' % (repo.name.lower(), arch.name, pkgname) + + +@register.simple_tag +def todopkg_details_link(todopkg): + pkg = todopkg.pkg + if not pkg: + return todopkg.pkgname + link = '<a href="%s" title="View package details for %s">%s</a>' + url = pkg_absolute_url(todopkg.repo, todopkg.arch, pkg.pkgname) + return link % (url, pkg.pkgname, pkg.pkgname) + +# vim: set ts=4 sw=4 et: |