Commit 03fd3b9f43a63270ee7a78a51a2ff2fe3a58eb9a
1 parent
7302bb16
Exists in
master
and in
39 other branches
Added link to twitter and facebook accounts
Showing
2 changed files
with
16 additions
and
6 deletions
Show diff stats
src/accounts/models.py
| 1 | 1 | ||
| 2 | +import urlparse | ||
| 3 | + | ||
| 2 | from django.db import models | 4 | from django.db import models |
| 3 | from django.contrib.auth.models import AbstractUser | 5 | from django.contrib.auth.models import AbstractUser |
| 4 | - | ||
| 5 | from django.core.urlresolvers import reverse | 6 | from django.core.urlresolvers import reverse |
| 6 | 7 | ||
| 7 | 8 | ||
| @@ -17,6 +18,12 @@ class User(AbstractUser): | @@ -17,6 +18,12 @@ class User(AbstractUser): | ||
| 17 | def get_absolute_url(self): | 18 | def get_absolute_url(self): |
| 18 | return reverse('user_profile', kwargs={'username': self.username}) | 19 | return reverse('user_profile', kwargs={'username': self.username}) |
| 19 | 20 | ||
| 21 | + def twitter_link(self): | ||
| 22 | + return urlparse.urljoin('https://twitter.com', self.twitter) | ||
| 23 | + | ||
| 24 | + def facebook_link(self): | ||
| 25 | + return urlparse.urljoin('https://www.facebook.com', self.facebook) | ||
| 26 | + | ||
| 20 | # We need to have `email` field set as unique but Django does not | 27 | # We need to have `email` field set as unique but Django does not |
| 21 | # support field overriding (at least not until 1.6). | 28 | # support field overriding (at least not until 1.6). |
| 22 | # The following workaroud allows to change email field to unique | 29 | # The following workaroud allows to change email field to unique |
src/accounts/templates/accounts/user_detail.html
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | {% block main-content %} | 9 | {% block main-content %} |
| 10 | 10 | ||
| 11 | <div id="user-profile" class="row"> | 11 | <div id="user-profile" class="row"> |
| 12 | - <div class="vcard col-lg-3 col-md-3 col-sm-4"> | 12 | + <div class="vcard col-lg-4 col-md-4 col-sm-4"> |
| 13 | <div class="thumbnail"> | 13 | <div class="thumbnail"> |
| 14 | {% gravatar user_.email 200 %} | 14 | {% gravatar user_.email 200 %} |
| 15 | </div> | 15 | </div> |
| @@ -43,23 +43,26 @@ | @@ -43,23 +43,26 @@ | ||
| 43 | </li> | 43 | </li> |
| 44 | {% endif %} | 44 | {% endif %} |
| 45 | {% if request.user.is_active %} | 45 | {% if request.user.is_active %} |
| 46 | + <li> | ||
| 46 | {% if user_.twitter %} | 47 | {% if user_.twitter %} |
| 47 | - <li><span class="icon-twitter icon-fixed-width"></span> {{ user_.twitter }}</li> | 48 | + <span class="icon-twitter icon-fixed-width"></span> <a target="_blank" href="{{ user_.twitter_link }}" title="{% trans 'Twitter account' %}">{{ user_.twitter }}</a> |
| 48 | {% endif %} | 49 | {% endif %} |
| 49 | {% if user_.facebook %} | 50 | {% if user_.facebook %} |
| 50 | - <li><span class="icon-facebook icon-fixed-width"></span> {{ user_.facebook }}</li> | 51 | + <span class="icon-facebook icon-fixed-width"></span> <a target="_blank" href="{{ user_.facebook_link }}" title="{% trans 'Facebook account' %}">{{ user_.facebook }}</a> |
| 51 | {% endif %} | 52 | {% endif %} |
| 53 | + </li> | ||
| 54 | + | ||
| 52 | {% if user_.google_talk %} | 55 | {% if user_.google_talk %} |
| 53 | <li><span class="icon-google-plus icon-fixed-width"></span> {{ user_.google_talk }}</li> | 56 | <li><span class="icon-google-plus icon-fixed-width"></span> {{ user_.google_talk }}</li> |
| 54 | {% endif %} | 57 | {% endif %} |
| 55 | {% if user_.webpage %} | 58 | {% if user_.webpage %} |
| 56 | - <li><span class="icon-link icon-fixed-width"></span> {{ user_.webpage }}</li> | 59 | + <li><span class="icon-link icon-fixed-width"></span> <a target="_blank" href="{{ user_.webpage }}" title="{% trans 'Personal webpage' %}">{{ user_.webpage }}</a></li> |
| 57 | {% endif %} | 60 | {% endif %} |
| 58 | {% endif %} | 61 | {% endif %} |
| 59 | </ul> | 62 | </ul> |
| 60 | </div> | 63 | </div> |
| 61 | 64 | ||
| 62 | - <div class="col-lg-5 col-md-5 col-sm-8"> | 65 | + <div class="col-lg-4 col-md-4 col-sm-8"> |
| 63 | <div class="panel panel-default"> | 66 | <div class="panel panel-default"> |
| 64 | <div class="panel-heading"> | 67 | <div class="panel-heading"> |
| 65 | <h3 class="panel-title">{% trans "Contributions by Area" %}</h3> | 68 | <h3 class="panel-title">{% trans "Contributions by Area" %}</h3> |