diff options
author | Dan McGee <dan@archlinux.org> | 2013-01-16 00:36:17 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-01-16 00:36:17 -0600 |
commit | 0b930fd92140858f4ad21e593feb057996af9b95 (patch) | |
tree | dcfb6220b0b7d8342b0072492b85407a71caf4f2 | |
parent | 1f9aef78f39c90191eddf2233c278086a15052de (diff) |
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>
-rw-r--r-- | main/templatetags/flags.py | 13 | ||||
-rw-r--r-- | templates/devel/clock.html | 5 | ||||
-rw-r--r-- | templates/mirrors/mirror_details.html | 5 | ||||
-rw-r--r-- | templates/mirrors/status.html | 5 | ||||
-rw-r--r-- | templates/mirrors/status_table.html | 3 | ||||
-rw-r--r-- | templates/public/developer_list.html | 3 | ||||
-rw-r--r-- | templates/public/download.html | 6 | ||||
-rw-r--r-- | templates/public/userlist.html | 3 |
8 files changed, 37 insertions, 6 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: diff --git a/templates/devel/clock.html b/templates/devel/clock.html index 02e42749..83fbb70b 100644 --- a/templates/devel/clock.html +++ b/templates/devel/clock.html @@ -1,9 +1,12 @@ {% extends "base.html" %} {% load static from staticfiles %} +{% load flags %} {% load tz %} {% block title %}Arch Linux - Developer World Clocks{% endblock %} +{% block head %}<link rel="stylesheet" type="text/css" href="{% static "flags/fam.css" %}" media="screen, projection" />{% endblock %} + {% block content %} <div id="dev-clocks-box" class="box"> <h2>Developer World Clocks</h2> @@ -45,7 +48,7 @@ <td>{{ dev.username }}</td> <td>{{ dev.userprofile.alias }}</td> <td>{{ dev.last_action }}</td> - <td>{% if dev.userprofile.country %}<img src="{{ dev.userprofile.country.flag }}" alt="{{ dev.userprofile.country.name }}"/> {% endif %}{{ dev.userprofile.location }}</td> + <td>{% country_flag dev.userprofile.country %}{{ dev.userprofile.location }}</td> <td>{{ dev.userprofile.time_zone }}</td> <td>{{ utc_now|timezone:dev.userprofile.time_zone|date:"Y-m-d H:i T" }}<span class="hide"> {{ dev.userprofile.time_zone }}</span></td> </tr> diff --git a/templates/mirrors/mirror_details.html b/templates/mirrors/mirror_details.html index a56123ff..8ea6bbec 100644 --- a/templates/mirrors/mirror_details.html +++ b/templates/mirrors/mirror_details.html @@ -1,9 +1,12 @@ {% extends "base.html" %} {% load static from staticfiles %} {% load mirror_status %} +{% load flags %} {% block title %}Arch Linux - {{ mirror.name }} - Mirror Details{% endblock %} +{% block head %}<link rel="stylesheet" type="text/css" href="{% static "flags/fam.css" %}" media="screen, projection" />{% endblock %} + {% block content %} <div class="box"> @@ -90,7 +93,7 @@ <tr class="{% cycle 'odd' 'even' %}"> <td>{% if m_url.protocol.is_download %}<a href="{{ m_url.url }}">{{ m_url.url }}</a>{% else %}{{ m_url.url }}{% endif %}</td> <td>{{ m_url.protocol }}</td> - <td class="country">{% if m_url.country %}<img src="{{ m_url.country.flag }}" alt=""/> {% endif %}{{ m_url.country.name }}</td> + <td class="country">{% country_flag m_url.country %}{{ m_url.country.name }}</td> <td>{{ m_url.has_ipv4|yesno|capfirst }}</td> <td>{{ m_url.has_ipv6|yesno|capfirst }}</td> <td>{{ m_url.last_sync|date:'Y-m-d H:i'|default:'unknown' }}</td> diff --git a/templates/mirrors/status.html b/templates/mirrors/status.html index ec2ae568..8d32d3fa 100644 --- a/templates/mirrors/status.html +++ b/templates/mirrors/status.html @@ -1,9 +1,12 @@ {% extends "base.html" %} {% load static from staticfiles %} {% load mirror_status %} +{% load flags %} {% block title %}Arch Linux - Mirror Status{% if tier != None %} - Tier {{ tier }}{% endif %}{% endblock %} +{% block head %}<link rel="stylesheet" type="text/css" href="{% static "flags/fam.css" %}" media="screen, projection" />{% endblock %} + {% block content %} <div id="mirrorstatus" class="box"> <h2>Mirror Status{% if tier != None %} - Tier {{ tier }}{% endif %}</h2> @@ -88,7 +91,7 @@ {% spaceless %}<tr class="{% cycle 'odd' 'even' %}"> <td>{{ log.url__url }}</td> <td>{{ log.url__protocol__protocol }}</td> - <td class="country">{% if log.country %}<img src="{{ log.country.flag }}" alt=""/> {% endif %}{{ log.country.name }}</td> + <td class="country">{% country_flag log.country %}{{ log.country.name }}</td> <td class="wrap">{{ log.error|linebreaksbr }}</td> <td>{{ log.last_occurred|date:'Y-m-d H:i' }}</td> <td>{{ log.error_count }}</td> diff --git a/templates/mirrors/status_table.html b/templates/mirrors/status_table.html index c7394de6..2dd7ef49 100644 --- a/templates/mirrors/status_table.html +++ b/templates/mirrors/status_table.html @@ -1,4 +1,5 @@ {% load mirror_status %} +{% load flags %} <table id="{{ table_id }}" class="results"> <thead> <tr> @@ -17,7 +18,7 @@ {% spaceless %}<tr class="{% cycle 'odd' 'even' %}"> <td>{{ m_url.url }}</td> <td>{{ m_url.protocol }}</td> - <td class="country">{% if m_url.country %}<img src="{{ m_url.country.flag }}" alt=""/> {% endif %}{{ m_url.country.name }}</td> + <td class="country">{% country_flag m_url.country %}{{ m_url.country.name }}</td> <td>{{ m_url.completion_pct|percentage:1 }}</td> <td>{{ m_url.delay|duration|default:'unknown' }}</td> <td>{{ m_url.duration_avg|floatformat:2 }}</td> diff --git a/templates/public/developer_list.html b/templates/public/developer_list.html index df4137eb..4401d97b 100644 --- a/templates/public/developer_list.html +++ b/templates/public/developer_list.html @@ -1,3 +1,4 @@ +{% load flags %} {% load pgp %} <div id="arch-bio-toc"> @@ -56,7 +57,7 @@ <td itemprop="birthDate">{% if prof.yob %}{{ prof.yob }}{% endif %}</td> </tr><tr> <th>Location:</th> - <td>{% if dev.userprofile.country %}<img src="{{ dev.userprofile.country.flag }}" alt="{{ dev.userprofile.country.name }}"/> {% endif %}{{ prof.location }}</td> + <td>{% country_flag dev.userprofile.country %}{{ prof.location }}</td> </tr><tr> <th>Languages:</th> <td>{{ prof.languages }}</td> diff --git a/templates/public/download.html b/templates/public/download.html index 0c96fcef..7de49778 100644 --- a/templates/public/download.html +++ b/templates/public/download.html @@ -2,8 +2,12 @@ {% load cache %} {% load url from future %} {% load static from staticfiles %} +{% load flags %} {% block title %}Arch Linux - Downloads{% endblock %} + +{% block head %}<link rel="stylesheet" type="text/css" href="{% static "flags/fam.css" %}" media="screen, projection" />{% endblock %} + {% block navbarclass %}anb-download{% endblock %} {% block content %} @@ -83,7 +87,7 @@ <div id="download-mirrors"> {% regroup mirror_urls by country as grouped_urls %} {% for country in grouped_urls %} - {% if country.grouper %}<h5><img src="{{ country.grouper.flag }}" alt=""/> {{ country.grouper.name }}</h5> + {% if country.grouper %}<h5>{% country_flag country.grouper %}{{ country.grouper.name }}</h5> {% else %}<h5>Worldwide</h5>{% endif %} <ul> {% for mirror_url in country.list %} diff --git a/templates/public/userlist.html b/templates/public/userlist.html index 0077f611..35104317 100644 --- a/templates/public/userlist.html +++ b/templates/public/userlist.html @@ -1,8 +1,11 @@ {% extends "base.html" %} +{% load static from staticfiles %} {% load cache %} {% block title %}Arch Linux - {{ user_type }}{% endblock %} +{% block head %}<link rel="stylesheet" type="text/css" href="{% static "flags/fam.css" %}" media="screen, projection" />{% endblock %} + {% block content %} {% cache 600 dev-tu-profiles user_type %} <div id="dev-tu-profiles" class="box"> |