Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
d00b8b3b
Commit
d00b8b3b
authored
Nov 29, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include gravatar images with user name (issue #171)
parent
26c73b61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
weblate/media/css/style.css
weblate/media/css/style.css
+4
-0
weblate/trans/models.py
weblate/trans/models.py
+2
-2
weblate/trans/util.py
weblate/trans/util.py
+23
-1
No files found.
weblate/media/css/style.css
View file @
d00b8b3b
...
...
@@ -280,3 +280,7 @@ textarea.code-example {
margin-top
:
0.3em
;
text-align
:
center
;
}
img
.avatar
{
width
:
1em
;
height
:
1em
;
}
weblate/trans/models.py
View file @
d00b8b3b
...
...
@@ -1296,10 +1296,10 @@ class Translation(models.Model):
return
get_user_display
(
self
.
lock_user
)
def
get_lock_display
(
self
):
return
_
(
'This translation is locked by %(user)s for translation till %(time)s!'
)
%
{
return
mark_safe
(
_
(
'This translation is locked by %(user)s for translation till %(time)s!'
)
%
{
'user'
:
self
.
get_lock_user_display
(),
'time'
:
self
.
get_lock_time_display
(),
}
}
)
def
is_locked
(
self
,
request
=
None
,
multi
=
False
):
'''
...
...
weblate/trans/util.py
View file @
d00b8b3b
...
...
@@ -23,9 +23,25 @@ import re
from
translate.misc
import
quote
from
translate.storage.properties
import
propunit
from
django.utils.translation
import
ugettext
as
_
from
django.utils.html
import
escape
from
django.utils.safestring
import
mark_safe
from
django.utils.hashcompat
import
md5_constructor
from
django.conf
import
settings
import
urllib
GRAVATAR_URL_PREFIX
=
getattr
(
settings
,
"GRAVATAR_URL_PREFIX"
,
"http://www.gravatar.com/"
)
GRAVATAR_DEFAULT_IMAGE
=
getattr
(
settings
,
"GRAVATAR_DEFAULT_IMAGE"
,
""
)
PLURAL_SEPARATOR
=
'
\
x00
\
x00
'
def
gravatar_for_email
(
email
,
size
=
80
):
'''
Generates url for gravatar.
'''
url
=
"%savatar/%s/?"
%
(
GRAVATAR_URL_PREFIX
,
md5_constructor
(
email
.
lower
()).
hexdigest
())
url
+=
urllib
.
urlencode
({
"s"
:
str
(
size
),
"default"
:
GRAVATAR_DEFAULT_IMAGE
})
return
escape
(
url
)
def
get_user_display
(
user
):
'''
Nicely formats user for display.
...
...
@@ -41,7 +57,13 @@ def get_user_display(user):
if
full_name
.
strip
()
==
''
:
full_name
=
user
.
username
return
full_name
# Get gravatar image
gravatar
=
gravatar_for_email
(
user
.
email
,
size
=
32
)
return
mark_safe
(
'<img src="%(gravatar)s" class="avatar" /> %(name)s'
%
{
'name'
:
escape
(
full_name
),
'gravatar'
:
gravatar
})
def
is_plural
(
s
):
'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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