[damned-lies] Add a summary view of current activities by language
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Add a summary view of current activities by language
- Date: Mon, 7 Nov 2011 17:19:34 +0000 (UTC)
commit 147a6f5329b5706a1a953476db37de0780e0699b
Author: Claude Paroz <claude 2xlibre net>
Date: Sun Nov 6 22:40:52 2011 +0100
Add a summary view of current activities by language
Fixes bug #566062
languages/urls.py | 2 +-
media/css/main.css | 1 +
templates/teams/team_detail.html | 9 +++--
templates/vertimus/activity_summary.html | 45 ++++++++++++++++++++++++++++++
vertimus/tests/__init__.py | 9 ++++++
vertimus/urls.py | 6 +++-
vertimus/views.py | 10 ++++++
7 files changed, 76 insertions(+), 6 deletions(-)
---
diff --git a/languages/urls.py b/languages/urls.py
index 068daed..226b5f6 100644
--- a/languages/urls.py
+++ b/languages/urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls.defaults import *
+from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('',
url(
diff --git a/media/css/main.css b/media/css/main.css
index c859098..7b8ca48 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -37,6 +37,7 @@ span.zero {
table.stats {
width: 100%;
+ margin-bottom: 0.5em;
}
.stats th {
diff --git a/templates/teams/team_detail.html b/templates/teams/team_detail.html
index 2f03c4e..fdd86ff 100644
--- a/templates/teams/team_detail.html
+++ b/templates/teams/team_detail.html
@@ -50,12 +50,13 @@ $(document).ready(function() {
{% for lang in team.get_languages %}
<h2>{{ lang.get_name }} ({{ lang.locale }})</h2>
- {% with 1 as show_all_modules_line %}
- {% with lang.get_release_stats as stats %}
+ {% with show_all_modules_line=1 stats=lang.get_release_stats %}
{% include "languages/language_release_summary.html" %}
{% endwith %}
- {% endwith %}
-<p><strong>{% trans "Plural forms:" %}</strong> {{ lang.get_plurals }}</p>
+{% if user.is_authenticated %}
+ <div class="float_right"><a href="{% url activity_by_language lang.locale %}">{% trans "Current activities" %}</a></div>
+{% endif %}
+<div><strong>{% trans "Plural forms:" %}</strong> {{ lang.get_plurals }}</div>
<h3><a href="." class="archives" id="{{ lang.locale|escapeat }}"><img src="{{ MEDIA_URL }}img/closed.png" /></a> {% trans "Archives" %}</h3>
<div id="div-rel-archives-{{ lang.locale|escapeat }}" class="empty" style="display:none;"></div>
diff --git a/templates/vertimus/activity_summary.html b/templates/vertimus/activity_summary.html
new file mode 100644
index 0000000..4897a18
--- /dev/null
+++ b/templates/vertimus/activity_summary.html
@@ -0,0 +1,45 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load humanize %}
+
+{% block extrahead %}
+<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.tablesorter.min.js"></script>
+<script type="text/javascript">
+$(document).ready(function()
+ {
+ $("#summary").tablesorter({
+ headers: {
+ 0: { sorter:'text' }
+ },
+ sortList: [[0,1]] });
+ }
+);
+</script>
+{% endblock %}
+
+{% block title %}
+ {% blocktrans with lang=language.name %}Activity summary for '{{ lang }}'{% endblocktrans %}
+{% endblock %}
+
+{% block content %}
+<div class="mainpage">
+
+<h1>{% blocktrans with lang=language.name url=language.get_team_url %}Activity summary for <a href="{{ url }}">{{ lang }}</a>{% endblocktrans %}</h1>
+
+<table class="tablesorter" id="summary">
+<thead><tr>
+ <th>{% trans "Date" %}</th><th>{% trans "Module" %}</th><th>{% trans "State" %}</th>
+</tr></thead>
+<tbody>
+{% for activity in activities %}
+<tr>
+ <td><span style="display: none;">{{ activity.updated|date:"c" }}</span>{{ activity.updated|naturalday:"DATE_FORMAT" }}</td>
+ <td><a href="{{ activity.get_absolute_url }}">{{ activity.branch.module.get_description }} - {{ activity.branch.name }} - {{ activity.domain.get_description }} - {{ activity.language.get_name }}</a></td>
+ <td>{{ activity.description }}</td>
+</tr>
+{% endfor %}
+</tbody>
+</table>
+
+</div>
+{% endblock %}
diff --git a/vertimus/tests/__init__.py b/vertimus/tests/__init__.py
index d60f176..363b97e 100644
--- a/vertimus/tests/__init__.py
+++ b/vertimus/tests/__init__.py
@@ -441,6 +441,15 @@ class VertimusTest(TeamsAndRolesTests):
self.assertContains(response,
"""<title>po (gedit/User Interface) - gedit (gnome-2-24) - Reserve for translation\n</title>""")
+ def test_activity_summary(self):
+ state = StateTranslating.objects.create(
+ branch=self.b, domain=self.d,
+ language=self.l,
+ person=self.pt)
+
+ response = self.client.get(reverse("activity_by_language", args=[self.l.locale]))
+ self.assertContains(response, self.m.description)
+
def test_mysql(self):
# Copied from test_action_undo() with minor changes
state = StateNone(branch=self.b, domain=self.d, language=self.l)
diff --git a/vertimus/urls.py b/vertimus/urls.py
index 2293d03..766ecee 100644
--- a/vertimus/urls.py
+++ b/vertimus/urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls.defaults import *
+from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('vertimus.views',
url(
@@ -25,4 +25,8 @@ urlpatterns = patterns('vertimus.views',
regex = r'^(?P<module_name>[\w\+\-\.]+)/(?P<branch_name>[\w\-\.]+)/(?P<domain_name>[\w~\-]+)/(?P<locale_name>[\w\- ]+)',
view = 'vertimus_by_names',
name = 'vertimus_by_names'),
+ url(
+ regex = r'^(?P<locale>[\w\- ]+)/activity_summary/$',
+ view = 'activity_by_language',
+ name = 'activity_by_language'),
)
diff --git a/vertimus/views.py b/vertimus/views.py
index e8d5553..9417d62 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -209,3 +209,13 @@ def latest_uploaded_po(request, module_name, branch_name, domain_name, locale_na
if not latest_upload:
raise Http404
return HttpResponseRedirect(latest_upload[0].merged_file.url())
+
+def activity_by_language(request, locale):
+ language = get_object_or_404(Language, locale=locale)
+ states = State.objects.filter(language=language)
+ context = {
+ 'pageSection': "languages",
+ 'language': language,
+ 'activities': states,
+ }
+ return render(request, 'vertimus/activity_summary.html', context)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]