Commit fbff6ae2 authored by Michal Čihař's avatar Michal Čihař

Show user translations on main page

parent 7284324b
......@@ -3,6 +3,29 @@
{% block content %}
<h2>{% trans "Your translations" %}</h2>
<table>
<thead>
<tr>
<th>{% trans "Language" %}</th>
<th colspan="2">{% trans "Translated" %}</th>
<th>{% trans "Fuzzy" %}</th>
</tr>
<tbody>
{% for trans in usertranslations %}
{% with trans.get_translated_percent as percent and trans.get_fuzzy_percent as fuzzy %}
<tr>
<th><a href="{{ trans.get_absolute_url }}">{{ trans.subproject }} - {% trans trans.language.name %}</a></th>
<td class="percent">{{ percent }}%</td>
<td class="progress"><div class="progress" id="{{ percent|floatformat:0 }}"></div></td>
<td class="percent">{{ fuzzy }}%</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
<h2>{% trans "Projects" %}</h2>
<table>
......
......@@ -20,6 +20,12 @@ logger = logging.getLogger('weblate')
def home(request):
projects = Project.objects.all()
usertranslations = None
if request.user.is_authenticated():
profile = request.user.get_profile()
usertranslations = Translation.objects.filter(language__in = profile.languages.all())
top_translations = Profile.objects.order_by('-translated')[:10]
top_suggestions = Profile.objects.order_by('-suggested')[:10]
......@@ -27,6 +33,7 @@ def home(request):
'projects': projects,
'top_translations': top_translations,
'top_suggestions': top_suggestions,
'usertranslations': usertranslations,
'title': settings.SITE_TITLE,
}))
......
Markdown is supported
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