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
8903b766
Commit
8903b766
authored
Nov 29, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Single place to get user name for display
parent
21ee8a2d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
12 deletions
+28
-12
weblate/accounts/models.py
weblate/accounts/models.py
+4
-0
weblate/html/base.html
weblate/html/base.html
+1
-1
weblate/html/index.html
weblate/html/index.html
+2
-2
weblate/html/list-comments.html
weblate/html/list-comments.html
+1
-1
weblate/html/translate.html
weblate/html/translate.html
+1
-1
weblate/html/translation.html
weblate/html/translation.html
+1
-1
weblate/trans/models.py
weblate/trans/models.py
+9
-6
weblate/trans/util.py
weblate/trans/util.py
+9
-0
No files found.
weblate/accounts/models.py
View file @
8903b766
...
...
@@ -42,6 +42,7 @@ from south.signals import post_migrate
from
weblate.lang.models
import
Language
from
weblate.trans.models
import
Project
from
weblate.trans.util
import
get_user_display
import
weblate
import
logging
...
...
@@ -191,6 +192,9 @@ class Profile(models.Model):
def
__unicode__
(
self
):
return
self
.
user
.
username
def
get_user_display
(
self
):
return
get_user_display
(
self
.
user
)
def
notify_user
(
self
,
notification
,
translation_obj
,
context
=
{},
headers
=
{}):
'''
Wrapper for sending notifications to user.
...
...
weblate/html/base.html
View file @
8903b766
...
...
@@ -33,7 +33,7 @@
<ul
id=
"menu"
>
{% if user.is_authenticated %}
<li><a
href=
"{% url 'profile' %}"
>
{% blocktrans with user.get_
full_name
as name %}Logged in as {{ name }}{% endblocktrans %}
</a></li>
<li><a
href=
"{% url 'profile' %}"
>
{% blocktrans with user.get_
profile.get_user_display
as name %}Logged in as {{ name }}{% endblocktrans %}
</a></li>
<li><a
href=
"{% url 'auth_logout' %}"
>
{% trans "Logout" %}
</a></li>
{% else %}
{% if registration_open %}
...
...
weblate/html/index.html
View file @
8903b766
...
...
@@ -76,7 +76,7 @@
<tbody>
{% for u in top_translations %}
<tr>
<td>
{{ u.
user.get_full_name
}}
</td>
<td>
{{ u.
get_user_display
}}
</td>
<td
class=
"percent"
>
{{ u.translated }}
</td>
</tr>
{% endfor %}
...
...
@@ -95,7 +95,7 @@
<tbody>
{% for u in top_suggestions %}
<tr>
<td>
{{ u.
user.get_full_name
}}
</td>
<td>
{{ u.
get_user_display
}}
</td>
<td
class=
"percent"
>
{{ u.suggested }}
</td>
</tr>
{% endfor %}
...
...
weblate/html/list-comments.html
View file @
8903b766
{% for comment in comments %}
<tr>
<td>
<strong>
{{ comment.
user.get_full_name
}}
</strong><br
/>
<strong>
{{ comment.
get_user_display
}}
</strong><br
/>
{{ comment.timestamp|date:"DATETIME_FORMAT" }}
</td>
<td
dir=
"auto"
>
{{ comment.comment }}
</td>
...
...
weblate/html/translate.html
View file @
8903b766
...
...
@@ -113,7 +113,7 @@
<tr><td
class=
"translatetext"
>
{{ suggestion.target|fmttranslation:unit.translation.language }}
</td></tr>
<tr><td>
{% if suggestion.user %}
{% blocktrans with suggestion.
user.get_full_name
as user %}Suggested by {{ user }}{% endblocktrans %}
{% blocktrans with suggestion.
get_user_display
as user %}Suggested by {{ user }}{% endblocktrans %}
{% else %}
{% trans "Suggested by anonymous user" %}
{% endif %}
...
...
weblate/html/translation.html
View file @
8903b766
...
...
@@ -110,7 +110,7 @@
<div
id=
"locking"
>
<p>
{% trans "Locking the translation will prevent others to work on translation." %}
</p>
{% if object.is_user_locked %}
<p>
{% trans "Locked by:" %} {{ object.
lock_user.get_full_name
}}
</p>
<p>
{% trans "Locked by:" %} {{ object.
get_lock_user_display
}}
</p>
<p>
{% trans "Lock valid till:" %} {{ object.lock_time|date:"DATETIME_FORMAT" }}
</p>
{% else %}
<p>
{% trans "Translation is currently not locked." %}
</p>
...
...
weblate/trans/models.py
View file @
8903b766
...
...
@@ -52,7 +52,7 @@ from weblate.lang.models import Language
from
weblate.trans.checks
import
CHECKS
from
weblate.trans.managers
import
TranslationManager
,
UnitManager
,
DictionaryManager
from
weblate.trans.filelock
import
FileLock
,
FileLockException
from
util
import
is_plural
,
split_plural
,
join_plural
,
get_source
,
get_target
,
is_translated
from
util
import
is_plural
,
split_plural
,
join_plural
,
get_source
,
get_target
,
is_translated
,
get_user_display
from
django.db.models.signals
import
post_syncdb
from
south.signals
import
post_migrate
...
...
@@ -1293,7 +1293,7 @@ class Translation(models.Model):
'''
Returns formatted lock user.
'''
return
self
.
lock_user
.
get_full_name
(
)
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!'
)
%
{
...
...
@@ -2607,6 +2607,9 @@ class Suggestion(models.Model):
'''
return
self
.
get_matching_unit
().
get_absolute_url
()
def
get_user_display
(
self
):
return
get_user_display
(
self
.
user
)
class
Comment
(
models
.
Model
):
checksum
=
models
.
CharField
(
max_length
=
40
,
db_index
=
True
)
comment
=
models
.
TextField
()
...
...
@@ -2618,6 +2621,9 @@ class Comment(models.Model):
class
Meta
:
ordering
=
[
'timestamp'
]
def
get_user_display
(
self
):
return
get_user_display
(
self
.
user
)
CHECK_CHOICES
=
[(
x
,
CHECKS
[
x
].
name
)
for
x
in
CHECKS
]
class
Check
(
models
.
Model
):
...
...
@@ -2709,10 +2715,7 @@ class Change(models.Model):
}
def
get_user_display
(
self
):
if
self
.
user
is
None
:
return
_
(
'None'
)
else
:
return
self
.
user
.
get_full_name
()
return
get_user_display
(
self
.
user
)
def
get_absolute_url
(
self
):
'''
...
...
weblate/trans/util.py
View file @
8903b766
...
...
@@ -25,6 +25,15 @@ from translate.storage.properties import propunit
PLURAL_SEPARATOR
=
'
\
x00
\
x00
'
def
get_user_display
(
user
):
'''
Nicely formats user for display.
'''
if
user
is
None
:
return
_
(
'None'
)
else
:
return
user
.
get_full_name
()
def
is_plural
(
s
):
'''
Checks whether string is plural form.
...
...
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