From 8314777c5858b8f9dd954ef906e19de1322a61d0 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 27 Feb 2010 10:08:04 -0600 Subject: Make files view AJAX if supported This will put the filelist inline on the package details page if using a capable browser. It should still fallback to a separate page if necessary (e.g. all those users using links on the site). Signed-off-by: Dan McGee --- packages/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/views.py b/packages/views.py index 9956b6ce..c5f87865 100644 --- a/packages/views.py +++ b/packages/views.py @@ -182,7 +182,10 @@ def files(request, name='', repo='', arch=''): pkg = get_object_or_404(Package, pkgname=name, repo__name__iexact=repo, arch__name=arch) files = PackageFile.objects.filter(pkg=pkg).order_by('path') - return render_to_response('packages/files.html', RequestContext(request, {'pkg':pkg,'files':files})) + template = 'packages/files.html' + if request.is_ajax(): + template = 'packages/files-ajax.html' + return render_to_response(template, RequestContext(request, {'pkg':pkg,'files':files})) @permission_required('main.change_package') def unflag(request, pkgid): -- cgit v1.2.3-54-g00ecf