[damned-lies: 2/9] Show reduced stats in vertimus detail view
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies: 2/9] Show reduced stats in vertimus detail view
- Date: Wed, 16 Mar 2011 09:04:53 +0000 (UTC)
commit 68949d537e0a36cfb3122694998e1960c95dc5c1
Author: Claude Paroz <claude 2xlibre net>
Date: Sat Feb 26 21:10:30 2011 +0100
Show reduced stats in vertimus detail view
stats/models.py | 8 ++++----
templates/vertimus/vertimus_detail.html | 30 +++++++++++++++++++++---------
vertimus/views.py | 1 +
3 files changed, 26 insertions(+), 13 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index f78e746..a814f3b 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -1208,9 +1208,9 @@ class Statistics(models.Model):
def get_reducedstat(self):
return self.part_po.translation_stat()
- def filename(self, potfile=False):
+ def filename(self, potfile=False, reduced=False):
if not self.is_pot_stats() and not potfile:
- return "%s.%s.%s.po" % (self.domain.potbase(), self.branch.name, self.language.locale)
+ return "%s.%s.%s.%spo" % (self.domain.potbase(), self.branch.name, self.language.locale, reduced and "reduced." or "")
else:
return "%s.%s.pot" % (self.domain.potbase(), self.branch.name)
@@ -1277,12 +1277,12 @@ class Statistics(models.Model):
subdir = "docs"
return os.path.join(settings.POTDIR, self.module_name()+'.'+self.branch.name, subdir, self.filename(potfile))
- def po_url(self, potfile=False):
+ def po_url(self, potfile=False, reduced=False):
""" Return URL of po file, e.g. for downloading the file """
subdir = ""
if self.domain.dtype == "doc":
subdir = "docs/"
- return utils.url_join("/POT/", "%s.%s" % (self.module_name(), self.branch.name), subdir, self.filename(potfile))
+ return utils.url_join("/POT/", "%s.%s" % (self.module_name(), self.branch.name), subdir, self.filename(potfile, reduced))
def pot_url(self):
return self.po_url(potfile=True)
diff --git a/templates/vertimus/vertimus_detail.html b/templates/vertimus/vertimus_detail.html
index abf0cf0..60c4206 100644
--- a/templates/vertimus/vertimus_detail.html
+++ b/templates/vertimus/vertimus_detail.html
@@ -57,18 +57,30 @@ $(document).ready(function() {
{% endif %}
<div style="line-height: 1.7">
- <em><a href="{{ pot_stats.pot_url }}">
+ <div><em><a href="{{ pot_stats.pot_url }}">
<img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download POT file" %}" /></a>
{{ pot_stats.pot_text }}
- </em>
- <br/>
- <a href="{{ po_url }}"><img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download PO file" %}" /></a> {% trans "Translated:" %}
- {{ stats.get_translationstat|safe }}
- <div class="graph graphinline">
- <div class="translated" style="width: {{ stats.tr_percentage }}px;"></div>
- <div class="fuzzy" style="{{ LANGUAGE_BIDI|yesno:"right,left" }}:{{ stats.tr_percentage }}px; width:{{ stats.fu_percentage }}px;"></div>
- <div class="untranslated" style="{{ LANGUAGE_BIDI|yesno:"right,left" }}:{{ stats.tr_percentage|add:stats.fu_percentage }}px; width: {{ stats.un_percentage }}px;"></div>
+ </em></div>
+ <div style="float:left">
+ <a href="{{ po_url }}"><img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download PO file" %}" /></a> {% trans "Translated:" %}
+ {{ stats.get_translationstat|safe }}
+ <div class="graph graphinline">
+ <div class="translated" style="width: {{ stats.tr_percentage }}px;"></div>
+ <div class="fuzzy" style="{{ LANGUAGE_BIDI|yesno:"right,left" }}:{{ stats.tr_percentage }}px; width:{{ stats.fu_percentage }}px;"></div>
+ <div class="untranslated" style="{{ LANGUAGE_BIDI|yesno:"right,left" }}:{{ stats.tr_percentage|add:stats.fu_percentage }}px; width: {{ stats.un_percentage }}px;"></div>
+ </div>
+ </div>
+ {% if stats.part_po %}
+ <div style="float:left; margin-left: 150px;">
+ <a href="{{ po_url_reduced }}"><img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download PO file" %}" /></a> {% trans "Translated (reduced):" %}
+ {{ stats.get_reducedstat|safe }}
+ <div class="graph graphinline">
+ <div class="translated" style="width: {{ stats.part_po.tr_percentage }}px;"></div>
+ <div class="fuzzy" style="{{ LANGUAGE_BIDI|yesno:"right,left" }}:{{ stats.part_po.tr_percentage }}px; width:{{ stats.part_po.fu_percentage }}px;"></div>
+ <div class="untranslated" style="{{ LANGUAGE_BIDI|yesno:"right,left" }}:{{ stats.part_po.tr_percentage|add:stats.part_po.fu_percentage }}px; width: {{ stats.part_po.un_percentage }}px;"></div>
+ </div>
</div>
+ {% endif %}
{% if pot_stats.fig_count and stats.language %}
<div class="docimages">
<a href="{% url stats.views.docimages module_name=module.name,potbase=stats.domain.name,branch_name=branch.name,langcode=stats.language.locale %}">
diff --git a/vertimus/views.py b/vertimus/views.py
index 476dd2a..247df60 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -124,6 +124,7 @@ def vertimus(request, branch, domain, language, stats=None, level="0"):
'stats': stats,
'pot_stats': pot_stats,
'po_url': po_url,
+ 'po_url_reduced': stats.part_po and stats.po_url(reduced=True) or None,
'branch': branch,
'other_states': other_branch_states,
'domain': domain,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]