Commit aed27ef8 authored by Jitka Novotna's avatar Jitka Novotna

copy of your language/translation stite2

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