From 7e1e5a5e8a2f3231d0878612508aba06f4397024 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 27 Feb 2010 10:31:55 -0600 Subject: files: template reuse Get rid of the copy/paste by including the sub-template. Signed-off-by: Dan McGee --- packages/views.py | 2 +- templates/packages/files-ajax.html | 8 -------- templates/packages/files-list.html | 8 ++++++++ templates/packages/files.html | 9 +-------- 4 files changed, 10 insertions(+), 17 deletions(-) delete mode 100644 templates/packages/files-ajax.html create mode 100644 templates/packages/files-list.html diff --git a/packages/views.py b/packages/views.py index e95d4a2b..8a2b4ec3 100644 --- a/packages/views.py +++ b/packages/views.py @@ -186,7 +186,7 @@ def files(request, name='', repo='', arch=''): files = PackageFile.objects.filter(pkg=pkg).order_by('path') template = 'packages/files.html' if request.is_ajax(): - template = 'packages/files-ajax.html' + template = 'packages/files-list.html' return render_to_response(template, RequestContext(request, {'pkg':pkg,'files':files})) @permission_required('main.change_package') diff --git a/templates/packages/files-ajax.html b/templates/packages/files-ajax.html deleted file mode 100644 index 9b4c83ad..00000000 --- a/templates/packages/files-ajax.html +++ /dev/null @@ -1,8 +0,0 @@ -
-

Files:

-
    - {% for file in files %} -
  • {{ file.path }}
  • - {% endfor %} -
-
diff --git a/templates/packages/files-list.html b/templates/packages/files-list.html new file mode 100644 index 00000000..9b4c83ad --- /dev/null +++ b/templates/packages/files-list.html @@ -0,0 +1,8 @@ +
+

Files:

+
    + {% for file in files %} +
  • {{ file.path }}
  • + {% endfor %} +
+
diff --git a/templates/packages/files.html b/templates/packages/files.html index dc0c64b7..1d87246c 100644 --- a/templates/packages/files.html +++ b/templates/packages/files.html @@ -3,14 +3,7 @@ {% block content %}

{{ pkg.pkgname }} {{ pkg.pkgver }}-{{ pkg.pkgrel }}

-
-

Files:

-
    - {% for file in files %} -
  • {{ file.path }}
  • - {% endfor %} -
-
+ {% include "packages/files-list.html" %}
{% endblock %} -- cgit v1.2.3-54-g00ecf