Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Political Memory
memopol
Commits
d58e2746
Commit
d58e2746
authored
Sep 04, 2016
by
Nicolas Joyard
Browse files
Set tooltips on group and country icons
parent
6e1ee5b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
memopol/templatetags/memopol_tags.py
View file @
d58e2746
...
...
@@ -84,12 +84,13 @@ def country_url(country):
@
register
.
filter
def
country_flag
(
country
):
def
country_flag
(
country
,
tplace
=
'bottom'
):
# Enable using groups instead of countries
code
=
country
.
code
if
hasattr
(
country
,
'code'
)
else
country
.
abbreviation
return
mark_safe
(
'<span class="flag-icon flag-icon-{code}"></span>'
.
format
(
code
=
code
.
lower
()))
u
'<span class="flag-icon flag-icon-{code}" title="{name}"'
u
' data-toggle="tooltip" data-placement="{place}"></span>'
.
format
(
code
=
code
.
lower
(),
place
=
tplace
,
name
=
country
.
name
))
@
register
.
filter
...
...
@@ -130,12 +131,13 @@ def mandate_icon(main_mandate):
@
register
.
filter
def
group_icon
(
group
):
def
group_icon
(
group
,
tplace
=
'bottom'
):
url
=
static
(
'images/group-%s.png'
%
cssify
(
'%s-%s'
%
(
group
.
chamber
.
abbreviation
,
group
.
abbreviation
)))
return
mark_safe
(
u
'<span class="group-icon" style="background-image: url({url})">'
u
'</span>'
.
format
(
url
=
url
,
name
=
group
.
abbreviation
))
u
'<span class="group-icon" style="background-image: url({url})"'
u
' data-toggle="tooltip" data-placement="{place}" title="{name}">'
u
'</span>'
.
format
(
url
=
url
,
name
=
group
.
name
,
place
=
tplace
))
@
register
.
filter
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment