From 965351e85b25d83c193fcf68e42947b3b22a6b8f Mon Sep 17 00:00:00 2001
From: Dan McGee
Date: Sat, 24 Mar 2012 13:01:17 -0500
Subject: Add retro_static template tag
Unfortunately {% static %} cannot interpret any context variables passed
into it, so we need to customize things in order to use it here since
our resources are sorted by year.
Signed-off-by: Dan McGee
---
retro/templatetags/__init__.py | 0
retro/templatetags/retro.py | 13 +++++++++++++
2 files changed, 13 insertions(+)
create mode 100644 retro/templatetags/__init__.py
create mode 100644 retro/templatetags/retro.py
diff --git a/retro/templatetags/__init__.py b/retro/templatetags/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/retro/templatetags/retro.py b/retro/templatetags/retro.py
new file mode 100644
index 00000000..c7fd9f00
--- /dev/null
+++ b/retro/templatetags/retro.py
@@ -0,0 +1,13 @@
+from django import template
+from django.contrib.staticfiles.storage import staticfiles_storage
+
+register = template.Library()
+
+
+@register.simple_tag
+def retro_static(year, path):
+ """Like the built-in {% static %} tag but with a little extra magic."""
+ full_path = "%s/%s" % (year, path)
+ return staticfiles_storage.url(full_path)
+
+# vim: set ts=4 sw=4 et:
--
cgit v1.2.3-2-g168b
From 99a0e1bc76295243026ffbd41af10d62787b9ec0 Mon Sep 17 00:00:00 2001
From: Dan McGee
Date: Sat, 24 Mar 2012 13:08:39 -0500
Subject: Convert retro pages to use {% retro_static %} template tag
Signed-off-by: Dan McGee
---
retro/templates/retro/index-20020328.html | 8 ++++----
retro/templates/retro/index-20030330.html | 12 ++++++------
retro/templates/retro/index-20040327.html | 24 ++++++++++++------------
retro/templates/retro/index-20050328.html | 26 +++++++++++++-------------
retro/templates/retro/index-20060328.html | 24 ++++++++++++------------
retro/templates/retro/index-20070324.html | 18 +++++++++---------
retro/templates/retro/index-20080311.html | 16 ++++++++--------
retro/templates/retro/index-20090327.html | 14 +++++++-------
retro/templates/retro/index-20100208.html | 16 ++++++++--------
retro/templates/retro/index-20110212.html | 20 ++++++++++----------
retro/views.py | 4 +---
11 files changed, 90 insertions(+), 92 deletions(-)
diff --git a/retro/templates/retro/index-20020328.html b/retro/templates/retro/index-20020328.html
index ca74cb4f..8c8f9d62 100644
--- a/retro/templates/retro/index-20020328.html
+++ b/retro/templates/retro/index-20020328.html
@@ -1,8 +1,8 @@
-
Arch Linux
-
+
@@ -27,7 +27,7 @@ Devel: 0.2
-
+
|
@@ -131,7 +131,7 @@ here to use the web interface.
<jvinet@zeroflux.org>
-
+
diff --git a/retro/templates/retro/index-20030330.html b/retro/templates/retro/index-20030330.html
index 59bb9189..449731af 100644
--- a/retro/templates/retro/index-20030330.html
+++ b/retro/templates/retro/index-20030330.html
@@ -1,11 +1,11 @@
-
+{% load retro_static from retro %}
Arch Linux
-
-
+
+
-
+
-
+
|
An i686-optimized Linux distribution.
|
@@ -245,6 +245,6 @@ Copyright ©2002, Judd Vinet
<jvinet@zeroflux.org>
-
+
diff --git a/retro/templates/retro/index-20040327.html b/retro/templates/retro/index-20040327.html
index 08588fe5..9c8ea0dd 100644
--- a/retro/templates/retro/index-20040327.html
+++ b/retro/templates/retro/index-20040327.html
@@ -1,10 +1,10 @@
-
+{% load retro_static from retro %}
Arch Linux
-
-
-
+
+
+