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 | 4 | from django.db import models |
| 3 | 5 | from django.contrib.auth.models import AbstractUser |
| 4 | - | |
| 5 | 6 | from django.core.urlresolvers import reverse |
| 6 | 7 | |
| 7 | 8 | |
| ... | ... | @@ -17,6 +18,12 @@ class User(AbstractUser): |
| 17 | 18 | def get_absolute_url(self): |
| 18 | 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 | 27 | # We need to have `email` field set as unique but Django does not |
| 21 | 28 | # support field overriding (at least not until 1.6). |
| 22 | 29 | # The following workaroud allows to change email field to unique | ... | ... |
src/accounts/templates/accounts/user_detail.html
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | {% block main-content %} |
| 10 | 10 | |
| 11 | 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 | 13 | <div class="thumbnail"> |
| 14 | 14 | {% gravatar user_.email 200 %} |
| 15 | 15 | </div> |
| ... | ... | @@ -43,23 +43,26 @@ |
| 43 | 43 | </li> |
| 44 | 44 | {% endif %} |
| 45 | 45 | {% if request.user.is_active %} |
| 46 | + <li> | |
| 46 | 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 | 49 | {% endif %} |
| 49 | 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 | 52 | {% endif %} |
| 53 | + </li> | |
| 54 | + | |
| 52 | 55 | {% if user_.google_talk %} |
| 53 | 56 | <li><span class="icon-google-plus icon-fixed-width"></span> {{ user_.google_talk }}</li> |
| 54 | 57 | {% endif %} |
| 55 | 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 | 60 | {% endif %} |
| 58 | 61 | {% endif %} |
| 59 | 62 | </ul> |
| 60 | 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 | 66 | <div class="panel panel-default"> |
| 64 | 67 | <div class="panel-heading"> |
| 65 | 68 | <h3 class="panel-title">{% trans "Contributions by Area" %}</h3> | ... | ... |