Commit 5bcaa09d authored by Jitka Novotna's avatar Jitka Novotna

user subscriptions without languages

parent d215152c
......@@ -63,16 +63,19 @@ $("#views-menu li a").click(function(){
<div class="tab-content">
{% if user.is_authenticated %}
<div class="tab-pane active" id="your-subscriptions">
{% if usersubscriptions %}
{% with usersubscriptions as translations and 2 as show_language and user.profile.hide_completed as hide_completed %}
{% include "list-translations.html" %}
{% endwith %}
{% if subscribed_projects %}
{% 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 %}
{% with subscribed_projects as projects %}
{% include "list-projects.html" %}
{% endwith %}
{% endif %}
{% else %}
{% with usersubscriptions as projects %}
{% include "list-projects.html" %}
{% endwith %}
<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 %} {# usersubscriptions #}
<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 %}
<p>
<a class="btn btn-default" href="{% url 'profile' %}#languages">{% trans "Manage your languages" %}</a>
<a class="btn btn-default" href="{% url 'profile' %}#subscriptions">{% trans "Manage your subscriptions" %}</a>
......
......@@ -44,13 +44,16 @@ def weblate_context(request):
componentlists = ComponentList.objects.all()
# Load user translations if user is authenticated
subscribed_projects = None
usersubscriptions = None
userlanguages = None
if request.user.is_authenticated():
subscribed_projects = request.user.profile.subscriptions.all()
usersubscriptions = Translation.objects.filter(
language__in=request.user.profile.languages.all(),
subproject__project__in=request.user.profile.subscriptions.all()
subproject__project__in=subscribed_projects
).order_by(
'subproject__project__name', 'subproject__name'
).select_related()
......@@ -91,6 +94,7 @@ def weblate_context(request):
'registration_open': appsettings.REGISTRATION_OPEN,
'acl_projects': projects,
'subscribed_projects': subscribed_projects,
'usersubscriptions': usersubscriptions,
'userlanguages': userlanguages,
'componentlists': componentlists,
......
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