Commit 32e8cece authored by Michal Čihař's avatar Michal Čihař

Add links to changes browser (fixes #192)

parent bff4bcd4
......@@ -30,6 +30,7 @@ from django.utils import translation
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.views.generic import TemplateView
from urllib import urlencode
from accounts.models import set_lang
from trans.models import Change, Project
......@@ -205,6 +206,7 @@ def user_page(request, user):
'page_profile': profile,
'page_user': user,
'last_changes': last_changes,
'last_changes_url': urlencode({'user': user.username}),
'user_projects': user_projects,
}
)
......
......@@ -46,6 +46,7 @@ from trans.views.helper import (
import weblate
import datetime
from urllib import urlencode
def home(request):
......@@ -90,6 +91,7 @@ def home(request):
'top_suggestions': top_suggestions,
'last_changes': last_changes,
'last_changes_rss': reverse('rss'),
'last_changes_url': '',
'usertranslations': usertranslations,
}))
......@@ -114,6 +116,7 @@ def show_language(request, lang):
'object': obj,
'last_changes': last_changes,
'last_changes_rss': reverse('rss-language', kwargs={'lang': obj.code}),
'last_changes_url': urlencode({'lang': obj.code}),
'dicts': Project.objects.filter(id__in=dicts),
}))
......@@ -182,6 +185,9 @@ def show_project(request, project):
'rss-project',
kwargs={'project': obj.slug}
),
'last_changes_url': urlencode(
{'project': obj.slug}
),
}))
......@@ -199,6 +205,9 @@ def show_subproject(request, project, subproject):
'rss-subproject',
kwargs={'subproject': obj.slug, 'project': obj.project.slug}
),
'last_changes_url': urlencode(
{'subproject': obj.slug, 'project': obj.project.slug}
),
}))
......@@ -312,6 +321,13 @@ def show_translation(request, project, subproject, lang):
'project': obj.subproject.project.slug
}
),
'last_changes_url': urlencode(
{
'lang': obj.language.code,
'subproject': obj.subproject.slug,
'project': obj.subproject.project.slug
}
),
}))
......
......@@ -24,9 +24,11 @@ from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.core.urlresolvers import reverse
from django.utils import formats
import uuid
import time
from urllib import urlencode
from trans.models import SubProject, Unit, Suggestion, Change
from trans.forms import (
......@@ -476,6 +478,21 @@ def translate(request, project, subproject, lang):
'object': obj,
'unit': unit,
'last_changes': unit.change_set.all()[:10],
'last_changes_rss': reverse(
'rss-translation',
kwargs={
'lang': obj.language.code,
'subproject': obj.subproject.slug,
'project': obj.subproject.project.slug
}
),
'last_changes_url': urlencode(
{
'lang': obj.language.code,
'subproject': obj.subproject.slug,
'project': obj.subproject.project.slug
}
),
'total': obj.unit_set.all().count(),
'search_id': search_result['search_id'],
'offset': offset,
......
{% load i18n %}
{% load translations %}
{% load url from future %}
{% if last_changes_rss %}
<a class="rss menu-float ui-state-default ui-corner-all" href="{{ last_changes_rss }}">
......@@ -24,7 +25,12 @@
<td><a href="{{ c.translation.get_absolute_url }}">{{ c.translation }}</a></td>
</tr>
{% empty %}
<tr><td colspan="4">{% trans "No recent activity has been recorded." %}</td></tr>
<tr><td colspan="4" class="tablenotice">
{% trans "No recent activity has been recorded." %}
</td></tr>
{% endfor %}
</tbody>
<tfoot><tr><td colspan="4" class="tablenotice">
<a href="{% url 'changes' %}?{{ last_changes_url }}">{% trans "Browse changes" %}</a>
</td></tr></tfoot>
</table>
......@@ -288,3 +288,8 @@ img.engage-icon {
.error input {
background-color: #F3D8D8;
}
.tablenotice {
text-align: center;
padding: 0.5em;
font-style: italic;
}
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