damned-lies r1347 - in trunk: . media/css stats stats/tests templates templates/vertimus



Author: claudep
Date: Wed Jan 14 11:21:33 2009
New Revision: 1347
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1347&view=rev

Log:
2009-01-14  Claude Paroz  <claude 2xlibre net>

	* media/css/main.css: Added style for having the translation graph outside
	of a table.
	* stats/models.py: Added ability to a Statistics object to render the
	corresponding pot file URL.
	* stats/tests/__init__.py: Added tests for po_url and pot_url.
	* templates/stats_show.html: Translation fix, and use of MEDIA_URL.
	* templates/vertimus/vertimus_detail.html: Remove a 'formatting' table.
	Add link to POT file. Fixes bug #567705.

Modified:
   trunk/ChangeLog
   trunk/media/css/main.css
   trunk/stats/models.py
   trunk/stats/tests/__init__.py
   trunk/templates/stats_show.html
   trunk/templates/vertimus/vertimus_detail.html

Modified: trunk/media/css/main.css
==============================================================================
--- trunk/media/css/main.css	(original)
+++ trunk/media/css/main.css	Wed Jan 14 11:21:33 2009
@@ -31,10 +31,15 @@
 div.graph {
   height: 14px;
   width: 100px;
-  border: 0px solid black; 
+  border: 0px solid black;
   position: relative;
 }
 
+div.graphinline {
+  display: inline;
+  top: -10px;
+}
+
 div.translated {
   position: absolute; 
   top: 0px;

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Wed Jan 14 11:21:33 2009
@@ -922,8 +922,8 @@
     def get_translationstat(self):
         return "%d%%&nbsp;(%d/%d/%d)" % (self.tr_percentage(), self.translated, self.fuzzy, self.untranslated)
     
-    def filename(self):
-        if self.language:
+    def filename(self, potfile=False):
+        if self.language and not potfile:
             return "%s.%s.%s.po" % (self.domain.potbase(), self.branch.name, self.language.locale)
         else:
             return "%s.%s.pot" % (self.domain.potbase(), self.branch.name)
@@ -987,13 +987,15 @@
             subdir = "docs"
         return os.path.join(settings.POTDIR, self.module_name()+'.'+self.branch.name, subdir, self.filename())
         
-    def po_url(self):
+    def po_url(self, potfile=False):
         """ Return URL of po file, e.g. for downloading the file """
+        subdir = ""
         if self.domain.dtype == "doc":
             subdir = "docs/"
-        else:
-            subdir = ""
-        return utils.url_join("/POT/", "%s.%s" % (self.module_name(), self.branch.name), subdir, self.filename())
+        return utils.url_join("/POT/", "%s.%s" % (self.module_name(), self.branch.name), subdir, self.filename(potfile))
+
+    def pot_url(self):
+        return self.po_url(potfile=True)
         
     def most_important_message(self):
         """ Return a message of type 1.'error', or 2.'warn, or 3.'warn """

Modified: trunk/stats/tests/__init__.py
==============================================================================
--- trunk/stats/tests/__init__.py	(original)
+++ trunk/stats/tests/__init__.py	Wed Jan 14 11:21:33 2009
@@ -97,6 +97,8 @@
         self.assertEquals(len(warn_infos), 1);
         ui_stat = Statistics.objects.get(branch=branch, domain__name='po', language__locale='fr')
         self.assertEquals(ui_stat.po_url(), u"/POT/gnome-hello.HEAD/gnome-hello.HEAD.fr.po");
+        self.assertEquals(ui_stat.pot_url(), u"/POT/gnome-hello.HEAD/gnome-hello.HEAD.pot");
+        self.assertEquals(doc_stat.po_url(), u"/POT/gnome-hello.HEAD/docs/gnome-hello-help.HEAD.fr.po");
 
         # Delete the branch (removing the repo checkout in the file system)
         checkout_path = branch.co_path()

Modified: trunk/templates/stats_show.html
==============================================================================
--- trunk/templates/stats_show.html	(original)
+++ trunk/templates/stats_show.html	Wed Jan 14 11:21:33 2009
@@ -10,7 +10,7 @@
     {% endifnotequal %}
   {% endifnotequal %}
   </h3>
-  <a href="{{ stat1.po_url }}"><img src="/media/img/download.png" alt="Download POT file" /></a>
+  <a href="{{ stat1.po_url }}"><img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download POT file" %}" /></a>
   {{ stat1.pot_text }}
   <!-- This is the title of the section that lists notices about a module -->
   {% if stat1.information_set.all %}
@@ -47,7 +47,7 @@
       <td>{{ line.get_translationstat|safe }}</td>
       {% if stat1.fig_count %}
       <td><a href="{% url stats.views.docimages module_name=module.name,potbase=stat1.domain.name,branch_name=branch.name,langcode=line.language.locale %}">
-          <img src="/media/img/figure.png" alt="{% trans "Display document figures" %}"></a>
+          <img src="{{ MEDIA_URL }}img/figure.png" alt="{% trans "Display document figures" %}"></a>
       </td>
       {% endif %}
       <td style="width: 108px; text-align: center;">

Modified: trunk/templates/vertimus/vertimus_detail.html
==============================================================================
--- trunk/templates/vertimus/vertimus_detail.html	(original)
+++ trunk/templates/vertimus/vertimus_detail.html	Wed Jan 14 11:21:33 2009
@@ -34,26 +34,20 @@
 {% endifnotequal %}
 </h3>
 
-<em>{{ stats.pot_text }}</em>
- 
-<table>
-  <tr>
-    <td><a href="{{ stats.po_url }}"><img src="{{ MEDIA_URL }}img/download.png" alt="Download PO file" /></a> {% trans "Translated:" %}</td>
-    <td>{{ stats.get_translationstat|safe }}</td>
-    <td><div class="graph">
-        <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>
-    </td>
-    <td>
-    {% if stats.fig_count and stats.language %}
+<div style="line-height: 1.7">
+<em><a href="{{ stats.pot_url }}"><img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download POT file" %}" /></a> {{ stats.pot_text }}</em><br />
+<a href="{{ stats.po_url }}"><img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download PO file" %}" /></a> {% trans "Translated:" %}
+{{ stats.get_translationstat|safe }}&nbsp;
+<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>
+{% if stats.fig_count and stats.language %}
     <a href="{% url stats.views.docimages module_name=module.name,potbase=stats.domain.name,branch_name=branch.name,langcode=stats.language.locale %}">
         <img src="{{ MEDIA_URL }}img/figure.png" alt="{% trans "Display document figures" %}"></a>
-    {% endif %}
-    </td>
-  </tr>
-</table>
+{% endif %}
+</div>
 
 {% if stats.information_set.all %}
 <h4>{% trans "Notices" %}</h4>



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