summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-01-16 00:36:17 -0600
committerDan McGee <dan@archlinux.org>2013-01-16 00:36:17 -0600
commit0b930fd92140858f4ad21e593feb057996af9b95 (patch)
treedcfb6220b0b7d8342b0072492b85407a71caf4f2 /main
parent1f9aef78f39c90191eddf2233c278086a15052de (diff)
downloadarchweb-0b930fd92140858f4ad21e593feb057996af9b95.tar.gz
archweb-0b930fd92140858f4ad21e593feb057996af9b95.zip
Convert all usages of flag icons to new spriterelease_2013-01-18
This uses a new template tag to avoid repeating construction of the necessary HTML element all over the place. The site should look exactly as it did before, except now you don't have to download 20+ images to see some pages. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main')
-rw-r--r--main/templatetags/flags.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/main/templatetags/flags.py b/main/templatetags/flags.py
new file mode 100644
index 00000000..22f524ca
--- /dev/null
+++ b/main/templatetags/flags.py
@@ -0,0 +1,13 @@
+from django import template
+
+register = template.Library()
+
+
+@register.simple_tag
+def country_flag(country):
+ if not country:
+ return ''
+ return '<span class="fam-flag fam-flag-%s" title="%s"></span> ' % (
+ country.code.lower(), country.name)
+
+# vim: set ts=4 sw=4 et: