summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-03-03 07:02:19 -0600
committerDan McGee <dan@archlinux.org>2010-03-03 07:02:19 -0600
commitcefb969d3c7d0d0380f63fcd50906be3b2825b4d (patch)
tree648c6d1650151d198e453220bd5c8b8171e22cf9 /main
parentf7e15ed728d7c5e3470f6127cc21e64baefcbfb2 (diff)
parent37e393ab6c8daf945c42fa0e4240a2343c74a3d0 (diff)
Merge branch 'cdn-jquery'release_2010-03-04
Diffstat (limited to 'main')
-rw-r--r--main/templatetags/__init__.py0
-rw-r--r--main/templatetags/cdn.py19
2 files changed, 19 insertions, 0 deletions
diff --git a/main/templatetags/__init__.py b/main/templatetags/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/main/templatetags/__init__.py
diff --git a/main/templatetags/cdn.py b/main/templatetags/cdn.py
new file mode 100644
index 00000000..8e946265
--- /dev/null
+++ b/main/templatetags/cdn.py
@@ -0,0 +1,19 @@
+from django import template
+from django.conf import settings
+
+register = template.Library()
+
+@register.tag
+def jquery(parser, token):
+ return JQueryNode()
+
+class JQueryNode(template.Node):
+ def render(self, context):
+ version = '1.4.2'
+ if getattr(settings, 'DEBUG', True):
+ jquery = '/media/jquery-%s.min.js' % version
+ else:
+ jquery = 'http://ajax.googleapis.com/ajax/libs/jquery/%s/jquery.min.js' % version
+ return '<script type="text/javascript" src="%s"></script>' % jquery
+
+# vim: set ts=4 sw=4 et: