Skip to content
Extraits de code Groupes Projets
Valider bc773059 rédigé par Nicolas Joyard's avatar Nicolas Joyard
Parcourir les fichiers

Add social network links

parent 3b1ba349
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# 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

1,77 ko

static/images/twitter.png

3,13 ko

......@@ -7,6 +7,7 @@
@import 'positions';
@import 'chambers';
@import 'groups';
@import 'external';
body {
background: #E5E5E5;
......
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
- 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
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter