summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2011-09-14 00:36:47 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2011-09-14 00:36:47 -0300
commit60a1fc6cc4cef0b9eed58ea4f0ca003b76ec382a (patch)
tree032ae62668538be964f57a12018d1ab9f696be5f /packages
parentfbd23db51b7160a308cd88e407e676994eb08b10 (diff)
parent617550628b39f94e6cb11ec032eb18e6195bf64a (diff)
Merge branch 'master' of git://projects.archlinux.org/archweb
Conflicts: local_settings.py.example media/archweb.css packages/templatetags/package_extras.py public/views.py templates/packages/details.html templates/packages/flag.html templates/packages/flag_confirmed.html templates/packages/flagged.html templates/packages/packages_list.html templates/packages/search.html templates/packages/signoffs.html templates/public/about.html templates/public/download.html templates/public/index.html templates/public/svn.html templates/releng/results.html templates/todolists/view.html
Diffstat (limited to 'packages')
-rw-r--r--packages/admin.py3
-rw-r--r--packages/templatetags/package_extras.py32
2 files changed, 30 insertions, 5 deletions
diff --git a/packages/admin.py b/packages/admin.py
index 3ecfdbb1..01b6ed6c 100644
--- a/packages/admin.py
+++ b/packages/admin.py
@@ -3,8 +3,9 @@ from django.contrib import admin
from .models import PackageRelation
class PackageRelationAdmin(admin.ModelAdmin):
- list_display = ('user', 'pkgbase', 'type')
+ list_display = ('user', 'pkgbase', 'type', 'created')
list_filter = ('type', 'user')
+ search_fields = ('user__username', 'pkgbase')
admin.site.register(PackageRelation, PackageRelationAdmin)
diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py
index d4d0ca1a..45a534c8 100644
--- a/packages/templatetags/package_extras.py
+++ b/packages/templatetags/package_extras.py
@@ -9,6 +9,10 @@ from django.utils.html import escape
register = template.Library()
+def link_encode(url, query, doseq=False):
+ data = urlencode(query, doseq).replace('&', '&amp;')
+ return "%s?%s" % (url, data)
+
class BuildQueryStringNode(template.Node):
def __init__(self, sortfield):
self.sortfield = sortfield
@@ -22,7 +26,7 @@ class BuildQueryStringNode(template.Node):
qs['sort'] = ['-' + self.sortfield]
else:
qs['sort'] = [self.sortfield]
- return urlencode(qs, True)
+ return urlencode(qs, True).replace('&', '&amp;')
@register.tag(name='buildsortqs')
def do_buildsortqs(parser, token):
@@ -37,6 +41,15 @@ def do_buildsortqs(parser, token):
return BuildQueryStringNode(sortfield[1:-1])
@register.simple_tag
+def pkg_details_link(pkg):
+ template = '<a href="%s" title="View package details for %s">%s</a>'
+ return template % (pkg.get_absolute_url(), pkg.pkgname, pkg.pkgname)
+
+@register.simple_tag
+def multi_pkg_details(pkgs):
+ return ', '.join([pkg_details_link(pkg) for pkg in pkgs])
+
+@register.simple_tag
def userpkgs(user):
if user:
# TODO don't hardcode
@@ -49,24 +62,35 @@ def userpkgs(user):
return ''
@register.simple_tag
+def get_wiki_link(package):
+ url = "http://wiki.parabolagnulinux.org/Special:Search"
+ data = {
+ 'search': package.pkgname,
+ }
+ return link_encode(url, data)
+
+@register.simple_tag
def bugs_list(package):
+ url = "https://bugs.parabolagnulinux.org/bugs/issue"
data = {
'@action': 'search',
'title': package.pkgname,
}
- return "https://bugs.parabolagnulinux.org/bugs/issue?%s" % urlencode(data)
+ return link_encode(url, data)
@register.simple_tag
def bug_report(package):
+ url = "https://bugs.parabolagnulinux.org/bugs/issue"
data = {
'@template': 'item',
'keyword': 'packages',
'title': '[%s]' % package.pkgname,
}
- return "https://bugs.parabolagnulinux.org/bugs/issue?%s" % urlencode(data)
+ return link_encode(url, data)
@register.simple_tag
def flag_unfree(package):
+ url = "https://bugs.parabolagnulinux.org/bugs/issue"
data = {
'@template': 'item',
'keyword': 'packages,unfree',
@@ -74,5 +98,5 @@ def flag_unfree(package):
'priority': 'critical',
'title': '[%s] Please put your reasons here (register first if you haven\'t)' % package.pkgname,
}
- return "https://bugs.parabolagnulinux.org/bugs/issue?%s" % urlencode(data)
+ return link_encode(url, data)
# vim: set ts=4 sw=4 et: