diff --git a/html/index.html b/html/index.html
index 154175b24..3f8f82b27 100644
--- a/html/index.html
+++ b/html/index.html
@@ -5,11 +5,24 @@
{% trans "Projects" %}
-
+
+
+
+{% trans "Project" %} |
+{% trans "Translated" %} |
+
+
{% for prj in projects %}
-- {{ prj.name }}
+{% with prj.get_translated_percent as percent %}
+
+{{ prj.name }} |
+{{ percent }}% |
+ |
+
+{% endwith %}
{% endfor %}
-
+
+
{% endblock %}
diff --git a/media/css/style.css b/media/css/style.css
index d0f01aaa3..91cdfd044 100644
--- a/media/css/style.css
+++ b/media/css/style.css
@@ -83,3 +83,9 @@ td.suggestions table {
.helptext {
font-size: smaller;
}
+.percent {
+ text-align: right;
+}
+div.progress {
+ width: 20em;
+}
diff --git a/media/js/loader.js b/media/js/loader.js
index 76772c172..aa309a6c2 100644
--- a/media/js/loader.js
+++ b/media/js/loader.js
@@ -18,4 +18,5 @@ $(document).ready(function(){
});
$('.accordion').accordion();
$('.errorlist').addClass('ui-state-error ui-corner-all');
+ $('div.progress').each(function f(i, e) {e = $(e); e.progressbar({ value: parseInt(e.attr('id')) })});
});
diff --git a/trans/models.py b/trans/models.py
index 0a2f0fff5..a816a842f 100644
--- a/trans/models.py
+++ b/trans/models.py
@@ -3,6 +3,7 @@ from django.db.models import Q
from django.contrib.auth.models import User
from django.conf import settings
from lang.models import Language
+from django.db.models import Sum
from django.utils.translation import ugettext_lazy, ugettext as _
from django.utils.safestring import mark_safe
from glob import glob
@@ -51,6 +52,11 @@ class Project(models.Model):
super(Project, self).save(*args, **kwargs)
+ def get_translated_percent(self):
+ translations = Translation.objects.filter(subproject__project = self).aggregate(Sum('translated'), Sum('total'))
+ return round(translations['translated__sum'] * 100.0 / translations['total__sum'], 1)
+
+
class SubProject(models.Model):
name = models.CharField(max_length = 100, help_text = _('Name to display'))
slug = models.SlugField(db_index = True, help_text = _('Name used in URLs'))