Commit bc773059 authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Add social network links

parent 3b1ba349
# 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)))
......@@ -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
Supports Markdown
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