[damned-lies] Align untrans/fuzzy/translated numbers (Fixes #657460)



commit 8bbc47b9a63934a2804f17c0a7336596f80033c2
Author: Claude Paroz <claude 2xlibre net>
Date:   Tue Aug 30 20:28:35 2011 +0200

    Align untrans/fuzzy/translated numbers (Fixes #657460)

 media/css/main.css                 |   11 +++++++++--
 stats/templatetags/stats_extras.py |    7 ++++---
 2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/media/css/main.css b/media/css/main.css
index 988d48c..19a559c 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -12,7 +12,14 @@ pre.stats {
   display: inline;
   margin: 0;
   white-space: pre;
-  font-size: 0.9em;
+  font-size: 0.8em;
+}
+pre.stats b {
+  font-size: 1.2em;
+}
+
+span.zero {
+  color: #ccc;
 }
 
 #stats-table {
@@ -52,7 +59,7 @@ table.stats {
   background-color: transparent;
   border-bottom: 1px solid #f0f0f0;
   color: gray;
-  font-size: 80%;
+  font-size: 0.7em;
   font-style: italic;
 }
 
diff --git a/stats/templatetags/stats_extras.py b/stats/templatetags/stats_extras.py
index b3b40d9..19ce6a1 100644
--- a/stats/templatetags/stats_extras.py
+++ b/stats/templatetags/stats_extras.py
@@ -59,10 +59,11 @@ def num_stats(stat, scope='full'):
     if 'translated_perc' in stats:
         stats['prc'] = stats['translated_perc']
     if 'prc' in stats:
-        model = '<pre class="stats"><b>%(prc)3s%%</b> (%(translated)s/%(fuzzy)s/%(untranslated)s)</pre>'
+        result = '<pre class="stats"><b>%(prc)3s%%</b> %(translated)6s %(fuzzy)5s %(untranslated)5s </pre>' % stats
+        result = result.replace(" 0 ", '<span class="zero"> 0 </span>')
     else:
-        model = "(%(translated)s/%(fuzzy)s/%(untranslated)s)"
-    return mark_safe(model % stats)
+        result = "(%(translated)s/%(fuzzy)s/%(untranslated)s)"
+    return mark_safe(result)
 
 @register.filter
 def vis_stats(stat, scope='full'):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]