summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-01-18 10:14:28 -0600
committerDan McGee <dan@archlinux.org>2011-01-18 10:21:47 -0600
commit487daf1c72f86a064b659f68d9f7722706997ab2 (patch)
tree11240c6831e3dfac969b4b4fd02fa28710d6f991 /packages
parentb66f11dedfc86dfd35b09b0d0c86f0d8f60bf412 (diff)
Make package signoffs AJAX if JS is enabled
This makes the signoffs page a heck of a lot more usable as you can go through and click a bunch at once without waiting for the rather slow page to reload. Hopefully the first step to bringing life back into this part of the site. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/urls.py2
-rw-r--r--packages/views.py30
2 files changed, 17 insertions, 15 deletions
diff --git a/packages/urls.py b/packages/urls.py
index da24ee03..c9006a12 100644
--- a/packages/urls.py
+++ b/packages/urls.py
@@ -11,7 +11,7 @@ package_patterns = patterns('packages.views',
urlpatterns = patterns('packages.views',
(r'^flaghelp/$', 'flaghelp'),
- (r'^signoffs/$', 'signoffs'),
+ (r'^signoffs/$', 'signoffs', {}, 'package-signoffs'),
(r'^signoff_package/(?P<arch>[A-z0-9]+)/(?P<pkgname>[A-z0-9\-+.]+)/$',
'signoff_package'),
(r'^update/$', 'update'),
diff --git a/packages/views.py b/packages/views.py
index 77fa3a07..4e683144 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -1,18 +1,19 @@
from django import forms
from django.contrib import messages
+from django.contrib.admin.widgets import AdminDateWidget
+from django.contrib.auth.models import User
+from django.contrib.auth.decorators import permission_required
from django.conf import settings
from django.core.mail import send_mail
-from django.template import loader, Context, RequestContext
+from django.db.models import Q
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404, redirect
-from django.contrib.auth.models import User
-from django.contrib.auth.decorators import permission_required
-from django.contrib.admin.widgets import AdminDateWidget
+from django.template import loader, Context, RequestContext
+from django.utils import simplejson
from django.views.decorators.cache import never_cache
from django.views.decorators.vary import vary_on_headers
from django.views.generic import list_detail
from django.views.generic.simple import direct_to_template
-from django.db.models import Q
from datetime import datetime
import string
@@ -276,15 +277,16 @@ def signoff_package(request, arch, pkgname):
pkgrel=pkg.pkgrel,
packager=request.user)
- if created:
- messages.info(request,
- "You have successfully signed off for %s on %s." % \
- (pkg.pkgname, pkg.arch))
- else:
- messages.warning(request,
- "You have already signed off for %s on %s." % \
- (pkg.pkgname, pkg.arch))
- return signoffs(request)
+ if request.is_ajax():
+ data = {
+ 'created': created,
+ 'approved': pkg.approved_for_signoff(),
+ 'user': str(request.user),
+ }
+ return HttpResponse(simplejson.dumps(data),
+ mimetype='application/json')
+
+ return redirect('package-signoffs')
def flaghelp(request):
return direct_to_template(request, 'packages/flaghelp.html')