Commit aed27ef8 authored by Jitka Novotna's avatar Jitka Novotna

copy of your language/translation stite2

parent ab6734d6
......@@ -22,7 +22,7 @@
{% if user.is_authenticated %}
<li class="dropdown active">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" id="views-title">
{% trans "Projects" %} <span class="caret"></span>
"TODO" <span class="caret"></span>
</a>
<ul class="dropdown-menu" id="views-menu">
<li><a href="#your-translations" data-toggle="tab">{% trans "Your translations" %}</a></li>
......@@ -62,24 +62,24 @@ $("#views-menu li a").click(function(){
<div class="tab-content">
{% if user.is_authenticated %}
<div class="tab-pane active" id="your-translations">
{% if usertranslations %}
{% with usertranslations as translations and 2 as show_language and user.profile.hide_completed as hide_completed %}
{% if usersubscriptions %}
{% with usersubscriptions as translations and 2 as show_language and user.profile.hide_completed as hide_completed %}
{% include "list-translations.html" %}
{% endwith %}
{% else %}
<p class="help-block">{% trans "Choose your languages in preferences and you will get an overview here of available translations for those languages in your subscribed projects." %}</p>
{% endif %} {# usertranslations #}
{% endif %} {# usersubscriptions #}
<p><a class="btn btn-default" href="{% url 'profile' %}#languages">{% trans "Manage your translations" %}</a></p>
</div>
<div class="tab-pane" id="your-languages">
{% if usertranslations %}
{% with usertranslations as translations and 2 as show_language and user.profile.hide_completed as hide_completed %}
{% if userlanguages %}
{% with userlanguages as translations and 2 as show_language and user.profile.hide_completed as hide_completed %}
{% include "list-translations.html" %}
{% endwith %}
{% else %}
<p class="help-block">{% trans "Choose your languages in preferences and you will get an overview here of available translations for those languages in all projects." %}</p>
{% endif %} {# usertranslations #}
{% endif %} {# userlanguages #}
<p><a class="btn btn-default" href="{% url 'profile' %}#languages">{% trans "Manage your translations" %}</a></p>
</div>
......
......@@ -42,14 +42,24 @@ def weblate_context(request):
projects = Project.objects.all_acl(request.user)
# Load user translations if user is authenticated
usertranslations = None
usersubscriptions = None
userlanguages = None
if request.user.is_authenticated():
usertranslations = Translation.objects.filter(
usersubscriptions = Translation.objects.filter(
language__in=request.user.profile.languages.all(),
subproject__project__in=projects,
).order_by(
'subproject__project__name', 'subproject__name'
).select_related()
userlanguages = Translation.objects.filter(
language__in=request.user.profile.languages.all(),
subproject__project__in=projects,
).order_by(
'subproject__project__name', 'subproject__name'
).select_related()
return {
'version': weblate.VERSION,
......@@ -79,5 +89,6 @@ def weblate_context(request):
'registration_open': appsettings.REGISTRATION_OPEN,
'acl_projects': projects,
'usertranslations': usertranslations,
'usersubscriptions': usersubscriptions,
'userlanguages': userlanguages,
}
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