Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Anthony
memopol
Commits
bc773059
Commit
bc773059
authored
Jun 01, 2016
by
Nicolas Joyard
Browse files
Add social network links
parent
3b1ba349
Changes
7
Hide whitespace changes
Inline
Side-by-side
memopol/templatetags/__init__.py
0 → 100644
View file @
bc773059
memopol/templatetags/memopol_tags.py
0 → 100644
View file @
bc773059
# coding: utf-8
from
django
import
template
from
django.utils.safestring
import
mark_safe
import
re
register
=
template
.
Library
()
link
=
'<a class="{network}-link" href="{url}" target="_blank">{user}</a>'
@
register
.
filter
def
twitter_link
(
url
):
return
mark_safe
(
link
.
format
(
network
=
'twitter'
,
url
=
url
,
user
=
re
.
sub
(
r
'.*/@?([^/]+)'
,
'@
\\
1'
,
url
)))
@
register
.
filter
def
facebook_link
(
url
):
return
mark_safe
(
link
.
format
(
network
=
'facebook'
,
url
=
url
,
user
=
re
.
sub
(
r
'.*/([^/]+)'
,
'
\\
1'
,
url
)))
static/images/facebook.png
0 → 100644
View file @
bc773059
1.77 KB
static/images/twitter.png
0 → 100644
View file @
bc773059
3.13 KB
static/less/base.less
View file @
bc773059
...
...
@@ -7,6 +7,7 @@
@import 'positions';
@import 'chambers';
@import 'groups';
@import 'external';
body {
background: #E5E5E5;
...
...
static/less/external.less
0 → 100644
View file @
bc773059
a.twitter-link:before,
a.facebook-link:before {
content: ' ';
overflow: hidden;
display: inline-block;
width: 1.5em;
height: 1.5em;
vertical-align: bottom;
}
a.twitter-link:before {
background-size: 110%;
background-position: center;
background-image: url(../images/twitter.png);
}
a.facebook-link:before {
background-size: 75%;
background-repeat: no-repeat;
background-position: center;
background-image: url(../images/facebook.png);
}
\ No newline at end of file
templates/representatives/_representative_block.haml
View file @
bc773059
-
load
memopol_tags
-
load
representatives_tags
-
load
representatives_recommendations_tags
-
load
humanize
...
...
@@ -39,3 +40,14 @@
Born
in
{{
representative.birth_place
}}
the
{{
representative.birth_date
|
naturalday:
'
d
/
m
/
Y
'
}}
({{
representative.get_gender_display
}})
-
if
representative
.
social_websites
|
length
>
0
%tr
%th
Social
%td
-
for
site
in
representative
.
social_websites
-
if
site
.
kind
==
'twitter'
=
site
.
url
|
twitter_link
-
elif
site
.
kind
==
'facebook'
=
site
.
url
|
facebook_link
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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