Commit 71d4fd4f authored by Nicolas Joyard's avatar Nicolas Joyard

Change icon display code + add sen/an icons

Editing stylesheets is no longer needed, just drop a 'group-CHAMBER-ABBR.png'
file in static/images and it will be loaded.
parent 323ad7da
......@@ -4,6 +4,7 @@ import re
from django import template
from django.contrib.humanize.templatetags.humanize import naturalday
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.utils.html import escape
......@@ -94,48 +95,49 @@ def country_flag(country):
@register.filter
def chamber_icon(chamber):
url = static('images/chamber-%s.png' % cssify(chamber.abbreviation))
return mark_safe(
u'<span class="chamber-icon ' +
u'chamber-icon-{abbr}"></span> {name}'.format(
name=chamber.name,
abbr=cssify(chamber.abbreviation)))
u'<span class="chamber-icon" style="background-image: url({url})">'
u'</span> {name}'.format(name=chamber.name, url=url))
@register.filter
def chamber_small_icon(chamber):
url = static('images/chamber-%s.png' % cssify(chamber.abbreviation))
return mark_safe(
u'<span class="chamber-icon ' +
u'chamber-icon-{abbr}" title="{name}"></span>'.format(
name=chamber.name,
abbr=cssify(chamber.abbreviation)))
u'<span class="chamber-icon" style="background-image: url({url})" '
u'title="{name}"></span>'.format(name=chamber.name, url=url))
@register.filter
def mandate_icon(main_mandate):
group = main_mandate.group
url = static('images/group-%s.png' % cssify('%s-%s' % (
group.chamber.abbreviation, group.abbreviation)))
return mark_safe(
u'<span class="group-icon ' +
u'group-icon-{abbr}"></span> {role} of {name}'.format(
u'<span class="group-icon" style="background-image: url({url})">'
u'</span> {role} of {name}'.format(
role=main_mandate.role,
name=main_mandate.group.name,
abbr=cssify(main_mandate.group.abbreviation)))
url=url))
@register.filter
def group_icon(group):
url = static('images/group-%s.png' % cssify('%s-%s' % (
group.chamber.abbreviation, group.abbreviation)))
return mark_safe(
u'<span class="group-icon ' +
u'group-icon-{abbr}"></span> {name}'.format(
abbr=cssify(group.abbreviation),
name=group.abbreviation))
u'<span class="group-icon" style="background-image: url({url})">'
u'</span> {name}'.format(url=url, name=group.abbreviation))
@register.filter
def group_long_icon(group):
url = static('images/group-%s.png' % cssify('%s-%s' % (
group.chamber.abbreviation, group.abbreviation)))
return mark_safe(
u'<span class="group-icon ' +
u'group-icon-{abbr}"></span> {name}'.format(
abbr=cssify(group.abbreviation),
name=group.name))
u'<span class="group-icon" style="background-image: url({url})">'
u'</span> {name}'.format(url=url, name=group.name))
@register.filter
......
......@@ -5,16 +5,4 @@
vertical-align: bottom;
background-size: 100%;
&.chamber-icon-an {
background-image: url(../images/chamber-an.png);
}
&.chamber-icon-ep {
background-image: url(../images/chamber-ep.png);
}
&.chamber-icon-sen {
background-image: url(../images/chamber-sen.png);
}
}
......@@ -5,29 +5,6 @@
vertical-align: bottom;
background-size: 100%;
&.group-icon-alde {
background-image: url(../images/group-alde.png);
}
&.group-icon-ecr {
background-image: url(../images/group-ecr.png);
}
&.group-icon-enf {
background-image: url(../images/group-enf.png);
}
&.group-icon-efdd {
background-image: url(../images/group-efdd.png);
}
&.group-icon-epp {
background-image: url(../images/group-epp.png);
}
&.group-icon-guengl {
background-image: url(../images/group-guengl.png);
}
&.group-icon-greensefa {
background-image: url(../images/group-greensefa.png);
}
&.group-icon-sd {
background-image: url(../images/group-sd.png);
}
background-repeat: no-repeat;
background-position: center center;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment