damned-lies r1243 - in trunk: . languages media/css stats templates templates/languages templates/people templates/teams templates/vertimus vertimus



Author: claudep
Date: Thu Dec 25 21:31:41 2008
New Revision: 1243
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1243&view=rev

Log:
2008-12-25  Claude Paroz  <claude 2xlibre net>

	* languages/urls.py:
	* languages/views.py: language_release shows either ui or doc.
	* media/css/main.css: Some more classes for vertimus_detail.html.
	* stats/models.py: Split get_lang_stats and get_lang_stats_by_type,
	slightly simplified function. Link stat object to corresponding StateDb.
	* templates/languages/language_release.html: Remove team details and show
	only ui or doc, not both.
	* templates/languages/language_release_stats.html: Link to vertimus_detail
	instead of module. Add columns for state and state_date.
	* templates/people/person_detail.html: Reverted StÃphane's previous
	commit. Didn't work.
	* templates/release_detail.html: Link separately ui and doc for language
	release.
	* templates/teams/team_detail.html: Link separately ui and doc. Reactivate
	team membership display.
	* templates/vertimus/vertimus_detail.html: Link back to release. General
	layout adjustments.
	* vertimus/models.py: Add missing 'created' property. New get_filename
	method.

Modified:
   trunk/ChangeLog
   trunk/languages/urls.py
   trunk/languages/views.py
   trunk/media/css/main.css
   trunk/stats/models.py
   trunk/templates/languages/language_release.html
   trunk/templates/languages/language_release_stats.html
   trunk/templates/people/person_detail.html
   trunk/templates/release_detail.html
   trunk/templates/teams/team_detail.html
   trunk/templates/vertimus/vertimus_detail.html
   trunk/vertimus/models.py

Modified: trunk/languages/urls.py
==============================================================================
--- trunk/languages/urls.py	(original)
+++ trunk/languages/urls.py	Thu Dec 25 21:31:41 2008
@@ -2,7 +2,7 @@
 
 urlpatterns = patterns('',
     url(r'^$', 'languages.views.languages', name='languages'),
-    url(r'^(?P<locale>[\w\- ]+)/(?P<release_name>[\w-]+)/$', 'languages.views.language_release', name='language_release'),
+    url(r'^(?P<locale>[\w\- ]+)/(?P<release_name>[\w-]+)/(?P<dtype>(ui|doc)+)/$', 'languages.views.language_release', name='language_release'),
        (r'^(?P<locale>[\w\- ]+)/(?P<release_name>[\w-]+).xml$', 'languages.views.language_release_xml'),
        (r'^(?P<locale>[\w\- ]+)/(?P<release_name>[\w-]+)/(?P<dtype>(ui|doc)+).tar.gz$', 'languages.views.language_release_tar'),
     url(r'^(?P<team_slug>[\w\- ]+)/$', 'teams.views.team', name='team_slug'),

Modified: trunk/languages/views.py
==============================================================================
--- trunk/languages/views.py	(original)
+++ trunk/languages/views.py	Thu Dec 25 21:31:41 2008
@@ -23,6 +23,7 @@
 import tarfile
 from datetime import date, datetime
 from django.shortcuts import render_to_response, get_object_or_404
+from django.utils.translation import ugettext as _
 from django.template import RequestContext
 from django.http import HttpResponse, HttpResponseRedirect
 from stats.conf import settings
@@ -39,15 +40,17 @@
     return render_to_response('languages/language_list.html', context,
                               context_instance=RequestContext(request))
 
-def language_release(request, locale, release_name):
+def language_release(request, locale, release_name, dtype):
     language = get_object_or_404(Language, locale=Language.unslug_locale(locale))
     release = get_object_or_404(Release, name=release_name)
-    stats = release.get_lang_stats(language)
+    stats = release.get_lang_stats_by_type(language, dtype)
     context = {
         'pageSection': "languages",
         'language': language,
         'release': release,
-        'stats': stats
+        'stats_title': {'ui':  _("UI Translations"),
+                        'doc': _("Documentation")}.get(dtype),
+        'stats': stats,
     }
     return render_to_response('languages/language_release.html', context,
                               context_instance=RequestContext(request))

Modified: trunk/media/css/main.css
==============================================================================
--- trunk/media/css/main.css	(original)
+++ trunk/media/css/main.css	Thu Dec 25 21:31:41 2008
@@ -164,6 +164,21 @@
   vertical-align: top;
 }
 
+/* used in vertimus_detail */
+td.action_head {
+  background: #C9DDF3;
+  border-bottom: dashed 2px;
+}
+td.action_content {
+  border-bottom: solid #CCCCCC 1px;
+}
+div.uploaded_file {
+  float:right;
+  background:#DDDDDD;
+  padding: 2px;
+  margin-left: 8px;
+}
+
 .error {
   font-style: italic;
   color: #666666;

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Thu Dec 25 21:31:41 2008
@@ -720,79 +720,82 @@
         """ Get statistics for a specific language, producing the stats data structure
             Used for displaying the language-release template """
         
-        # Sorted by module to allow grouping ('fake' stats)
-        pot_stats = Statistics.objects.filter(language=None, branch__releases=self).order_by('domain__module__id', 'domain__dtype')
-        stats = {'doc':{'dtype':'doc', 'totaltrans':0, 'totalfuzzy':0, 'totaluntrans':0, 'categs':{}, 'all_errors':[]}, 
-                 'ui':{'dtype':'ui', 'totaltrans':0, 'totalfuzzy':0, 'totaluntrans':0, 'categs':{}, 'all_errors':[]} 
+        stats = {'doc': self.get_lang_stats_by_type(lang, 'doc'),
+                 'ui':  self.get_lang_stats_by_type(lang, 'ui'), 
                 }
+        return stats
+    
+    def get_lang_stats_by_type(self, lang, dtype):
+        from vertimus.models import StateDb # import here to prevent a circular dependency
+        
+        stats = {'dtype':dtype, 'totaltrans':0, 'totalfuzzy':0, 'totaluntrans':0, 'categs':{}, 'all_errors':[]}
+        # Sorted by module to allow grouping ('fake' stats)
+        pot_stats = Statistics.objects.filter(language=None, branch__releases=self, domain__dtype=dtype).order_by('domain__module__id')
+        tr_stats = Statistics.objects.filter(language=lang, branch__releases=self, domain__dtype=dtype).order_by('domain__module__id')
+        vt_states = StateDb.objects.filter(language=lang, branch__releases=self, domain__dtype=dtype)
         for stat in pot_stats:
-            dtype = stat.domain.dtype
             categdescr = stat.branch.category_set.get(release=self).name
             domname = _(stat.domain.description)
             modname = stat.domain.module.name
-            if not stats[dtype]['categs'].has_key(categdescr):
-                stats[dtype]['categs'][categdescr] = {'cattrans':0, 'catfuzzy':0, 
-                                                      'catuntrans':0, 'modules':{}}
-            stats[dtype]['totaluntrans'] += stat.untranslated
-            stats[dtype]['categs'][categdescr]['catuntrans'] += stat.untranslated
-            if not stats[dtype]['categs'][categdescr]['modules'].has_key(modname):
+            if not stats['categs'].has_key(categdescr):
+                stats['categs'][categdescr] = {'cattrans':0, 'catfuzzy':0, 
+                                               'catuntrans':0, 'modules':{}}
+            # Try to get translated stat, else stick with POT stat
+            try:
+                stat = tr_stats.get(branch=stat.branch, domain=stat.domain)
+                stats['all_errors'].extend(stat.information_set.all())
+            except Statistics.DoesNotExist:
+                pass
+
+            # Search if a state exists for this statistic
+            try:
+                stat.state = vt_states.get(branch=stat.branch, domain=stat.domain)
+            except StateDb.DoesNotExist:
+                stat.state = None
+
+            stats['totaltrans'] += stat.translated
+            stats['totalfuzzy'] += stat.fuzzy
+            stats['totaluntrans'] += stat.untranslated
+            stats['categs'][categdescr]['cattrans'] += stat.translated
+            stats['categs'][categdescr]['catfuzzy'] += stat.fuzzy
+            stats['categs'][categdescr]['catuntrans'] += stat.untranslated
+            if not stats['categs'][categdescr]['modules'].has_key(modname):
                 # first element is a placeholder for a fake stat
-                stats[dtype]['categs'][categdescr]['modules'][modname] = {' fake':None, domname:stat}
+                stats['categs'][categdescr]['modules'][modname] = {' fake':None, domname:stat}
                 previous_domname = domname
             else:
-                if len(stats[dtype]['categs'][categdescr]['modules'][modname]) < 3:
+                if len(stats['categs'][categdescr]['modules'][modname]) < 3:
                     # Create a fake statistics object for module summary
-                    stats[dtype]['categs'][categdescr]['modules'][modname][' fake'] = FakeStatistics(stat.domain.module, dtype)
-                    stats[dtype]['categs'][categdescr]['modules'][modname][' fake'].untrans(stats[dtype]['categs'][categdescr]['modules'][modname][previous_domname])
-                stats[dtype]['categs'][categdescr]['modules'][modname][domname] = stat
-                stats[dtype]['categs'][categdescr]['modules'][modname][' fake'].untrans(stat)
-            #stats[dtype]['categs'][categdescr]['modules']["%s-%s" % (stat.branch.id, stat.domain.id)] = stat
-        
-        # Second pass for translated stats
-        tr_stats = Statistics.objects.filter(language=lang, branch__releases=self).order_by('domain__module__id')
-        for stat in tr_stats:
-            dtype = stat.domain.dtype
-            categdescr = stat.branch.category_set.get(release=self).name
-            domname = _(stat.domain.description)
-            modname = stat.domain.module.name
-            stats[dtype]['totaltrans'] += stat.translated
-            stats[dtype]['totalfuzzy'] += stat.fuzzy
-            stats[dtype]['totaluntrans'] -= (stat.translated + stat.fuzzy)
-            stats[dtype]['categs'][categdescr]['cattrans'] += stat.translated
-            stats[dtype]['categs'][categdescr]['catfuzzy'] += stat.fuzzy
-            stats[dtype]['categs'][categdescr]['catuntrans'] -= (stat.translated + stat.fuzzy)
-            if stats[dtype]['categs'][categdescr]['modules'][modname][' fake']:
-                stats[dtype]['categs'][categdescr]['modules'][modname][' fake'].trans(stat)
-            # Replace POT stat by translated stat
-            stats[dtype]['categs'][categdescr]['modules'][modname][domname] = stat
-            stats[dtype]['all_errors'].extend(stat.information_set.all())
-        
+                    stats['categs'][categdescr]['modules'][modname][' fake'] = FakeStatistics(stat.domain.module, dtype)
+                    stats['categs'][categdescr]['modules'][modname][' fake'].trans(stats['categs'][categdescr]['modules'][modname][previous_domname])
+                stats['categs'][categdescr]['modules'][modname][domname] = stat
+                stats['categs'][categdescr]['modules'][modname][' fake'].trans(stat)
+              
         # Compute percentages and sorting
-        for dtype in ['ui', 'doc']:
-            stats[dtype]['total'] = stats[dtype]['totaltrans'] + stats[dtype]['totalfuzzy'] + stats[dtype]['totaluntrans']
-            if stats[dtype]['total'] > 0:
-                stats[dtype]['totaltransperc'] = int(100*stats[dtype]['totaltrans']/stats[dtype]['total'])
-                stats[dtype]['totalfuzzyperc'] = int(100*stats[dtype]['totalfuzzy']/stats[dtype]['total'])
-                stats[dtype]['totaluntransperc'] = int(100*stats[dtype]['totaluntrans']/stats[dtype]['total'])
-            else:
-                stats[dtype]['totaltransperc'] = 0
-                stats[dtype]['totalfuzzyperc'] = 0
-                stats[dtype]['totaluntransperc'] = 0
-            for key, categ in stats[dtype]['categs'].items():
-                categ['catname'] = Category.get_cat_name(key)
-                categ['cattotal'] = categ['cattrans'] + categ['catfuzzy'] + categ['catuntrans']
-                categ['cattransperc'] = int(100*categ['cattrans']/categ['cattotal'])
-                # Sort modules
-                mods = [[name,mod] for name, mod in categ['modules'].items()]
-                mods.sort()
-                categ['modules'] = mods
-                # Sort domains
-                for mod in categ['modules']:
-                    doms = [(name,dom) for name, dom in mod[1].items()]
-                    doms.sort()
-                    mod[1] = doms
-            # Sort errors
-            stats[dtype]['all_errors'].sort()
+        stats['total'] = stats['totaltrans'] + stats['totalfuzzy'] + stats['totaluntrans']
+        if stats['total'] > 0:
+            stats['totaltransperc'] = int(100*stats['totaltrans']/stats['total'])
+            stats['totalfuzzyperc'] = int(100*stats['totalfuzzy']/stats['total'])
+            stats['totaluntransperc'] = int(100*stats['totaluntrans']/stats['total'])
+        else:
+            stats['totaltransperc'] = 0
+            stats['totalfuzzyperc'] = 0
+            stats['totaluntransperc'] = 0
+        for key, categ in stats['categs'].items():
+            categ['catname'] = Category.get_cat_name(key)
+            categ['cattotal'] = categ['cattrans'] + categ['catfuzzy'] + categ['catuntrans']
+            categ['cattransperc'] = int(100*categ['cattrans']/categ['cattotal'])
+            # Sort modules
+            mods = [[name,mod] for name, mod in categ['modules'].items()]
+            mods.sort()
+            categ['modules'] = mods
+            # Sort domains
+            for mod in categ['modules']:
+                doms = [(name,dom) for name, dom in mod[1].items()]
+                doms.sort()
+                mod[1] = doms
+        # Sort errors
+        stats['all_errors'].sort()
         return stats
 
     def get_lang_files(self, lang, dtype):
@@ -1023,15 +1026,10 @@
         self.untranslated = 0
         self.partial_po = False
     
-    def untrans(self, stat):
-        """ Called for POT file, so only untranslated is concerned """
-        self.untranslated += stat.untranslated
-        stat.partial_po = True
-    
     def trans(self, stat):
         self.translated += stat.translated
         self.fuzzy += stat.fuzzy
-        self.untranslated -= (stat.translated + stat.fuzzy)
+        self.untranslated += stat.untranslated
         stat.partial_po = True
     
     def is_fake(self):

Modified: trunk/templates/languages/language_release.html
==============================================================================
--- trunk/templates/languages/language_release.html	(original)
+++ trunk/templates/languages/language_release.html	Thu Dec 25 21:31:41 2008
@@ -6,21 +6,7 @@
 {% block content %}
 <div class="mainpage">
 
-{% with language.locale as locale %}
-{% with language.team as team %}
-{% if team %}
-  <h1>{% blocktrans with team.get_description as lang %}{{ lang }} Translation Team â {{ locale }}{% endblocktrans %}</h1>
-
-  {% include "teams/team_base.html" %}
-
-{% else %}
-  <h1>{% blocktrans %}Language code: {{ locale }}{% endblocktrans %}</h1>
-  <p>{% blocktrans %}There is no translation team in charge of '{{ locale }}' translation.{% endblocktrans %}</p>
-{% endif %}
-{% endwith %}
-{% endwith %}
-
-<h2>{% trans release.description %}</h2>
+<h2>{% trans release.description %} - <a href="{{ language.get_team_url }}">{{ language.get_name }}</a></h2>
 
 <p id="hide">
    <a href="#" onclick="return showHideCompleted();">{% trans "Hide completed modules" %}</a>
@@ -34,22 +20,10 @@
 <p><i>{% trans "The modules of this release are not part of the GNOME SVN repository. Please check each module's web page to see where to send translations." %}</i></p>
 {% endifequal %}
 
-<table><tr>
-{% if stats.doc.total %}
-  <td valign="top" width="50%"><!-- two columns set-up -->
-  <h3>{% trans "Documentation" %}</h3>
-  {% with stats.doc as modstats %}
-    {% include "languages/language_release_stats.html" %}
-  {% endwith %}
-  </td>
-{% endif %}  
-  <td valign="top"><!-- second column -->
-
-  <h3>{% trans "UI translations" %}</h3>
-  {% with stats.ui as modstats %}
-    {% include "languages/language_release_stats.html" %}
-  {% endwith %}
-</td></tr></table><!-- end two column layout -->
+<h3>{{ stats_title }}</h3>
+{% with stats as modstats %}
+  {% include "languages/language_release_stats.html" %}
+{% endwith %}
 
 </div>
 {% endblock %}

Modified: trunk/templates/languages/language_release_stats.html
==============================================================================
--- trunk/templates/languages/language_release_stats.html	(original)
+++ trunk/templates/languages/language_release_stats.html	Thu Dec 25 21:31:41 2008
@@ -39,23 +39,19 @@
           {% if dom.1.partial_po %}
             {# This is a partial po, indented, with the domain description #}
             <td class="leftcell" style="padding-left:2em; padding-right:2em;">
-            <a href="{{ dom.1.po_url }}"><img src="/media/img/download.png" alt="{% trans "Download po file" %}"></a>
-            {{ dom.1.domain.description }}
-            </td>
+            <a href="{% url vertimus-stats-id-view dom.1.id %}">{{ dom.1.domain.description }}</a>
           {% else %}
             <td class="leftcell">
             {% if not dom.1.is_fake %}
-              <a href="{{ dom.1.po_url }}"><img src="/media/img/download.png" alt="{% trans "Download po file" %}"></a>
-              <a href="{% url stats.views.module modname %}">
+              <a href="{% url vertimus-stats-id-view dom.1.id %}">{{ dom.1.module_description }}</a>
             {% else %}
-              <a href="{% url stats.views.module modname %}" style="font-style: italic;">
+              <em>{{ dom.1.module_description }}</em>
             {% endif %}
-            {{ dom.1.module_description }}</a>
-            {% for err in dom.1.information_set.all %}
-              <img src="{{ err.get_icon }}" title="{{ err.get_description }}" alt="{{ err.type }}" />
-            {% endfor %}
-            </td>
           {% endif %}
+          {% for err in dom.1.information_set.all %}
+            <img src="{{ err.get_icon }}" title="{{ err.get_description }}" alt="{{ err.type }}" />
+          {% endfor %}
+          </td>
           <td>{{ dom.1.tr_percentage }}%&nbsp;({{ dom.1.translated }}/{{ dom.1.fuzzy }}/{{ dom.1.untranslated }})</td>
           <td style="width: 108px; text-align: center; background:inherit;"><div class="graph">
               <div class="translated" style="width: {{ dom.1.tr_percentage }}px;"></div>
@@ -65,6 +61,13 @@
               {% endwith %}
              </div>
            </td>
+           <td>
+           {% if dom.1.state.name %}
+             {% ifnotequal dom.1.state.name "None" %}
+             <em><small>{{ dom.1.state.name }} - {{ dom.1.state.updated|date:"Y-m-d" }}</small></em>
+             {% endifnotequal %}
+           {% endif %}
+           </td>
         </tr>
       {% endif %}
       {% endwith %}

Modified: trunk/templates/people/person_detail.html
==============================================================================
--- trunk/templates/people/person_detail.html	(original)
+++ trunk/templates/people/person_detail.html	Thu Dec 25 21:31:41 2008
@@ -12,7 +12,7 @@
       <div class="right_actions">
         {% include "logout_form.html" %}<br />
         {% if not profile_form %}
-        <a href="{% url people.views.person_detail_from_username slug=person.username %}">
+        <a href="{% url people.views.person_detail_from_username slug=person.username %}edit">
           <img src="/media/img/edit.png" alt="{% trans "Edit" %}" title="{% trans "Edit" %}" /></a>
         {% endif %}
       </div>

Modified: trunk/templates/release_detail.html
==============================================================================
--- trunk/templates/release_detail.html	(original)
+++ trunk/templates/release_detail.html	Thu Dec 25 21:31:41 2008
@@ -19,11 +19,13 @@
 {% for lstats in release.get_global_stats %}
 <tr>
   <td class="leftcell" style="font-size:120%;">
-    <a href="{% url language_release locale=lstats.lang_locale release_name=release.name %}">{% trans lstats.lang_name %}</a>
+    {% trans lstats.lang_name %}</a>
   </td>
   
   {% ifnotequal lstats.doc_trans|add:lstats.doc_fuzzy "0" %}
-  <td>{{ lstats.doc_percent }}% ({{ lstats.doc_trans }}/{{ lstats.doc_fuzzy }}/{{ lstats.doc_untrans }})</td>
+  <td><a href="{% url language_release lstats.lang_locale release.name "doc" %}">
+      {{ lstats.doc_percent }}% ({{ lstats.doc_trans }}/{{ lstats.doc_fuzzy }}/{{ lstats.doc_untrans }})</a>
+  </td>
   {% else %}
   <td>-</td>
   {% endifnotequal %}
@@ -37,7 +39,9 @@
      </div>
    </td>
   
-  <td>{{ lstats.ui_percent }}% ({{ lstats.ui_trans }}/{{ lstats.ui_fuzzy }}/{{ lstats.ui_untrans }})</td>
+  <td><a href="{% url language_release lstats.lang_locale release.name "doc" %}">
+      {{ lstats.ui_percent }}% ({{ lstats.ui_trans }}/{{ lstats.ui_fuzzy }}/{{ lstats.ui_untrans }})</a>
+  </td>
   <td style="width: 108px; text-align: center;"><div class="graph">
       <div class="translated" style="width: {{ lstats.ui_percent }}px;"></div>
       <div class="fuzzy" style="{{ LANGUAGE_BIDI|yesno:"right,left" }}:{{ lstats.ui_percent }}px; width:{{ lstats.ui_percentfuzzy }}px;"></div>

Modified: trunk/templates/teams/team_detail.html
==============================================================================
--- trunk/templates/teams/team_detail.html	(original)
+++ trunk/templates/teams/team_detail.html	Thu Dec 25 21:31:41 2008
@@ -24,11 +24,13 @@
   {% for stat in lang.get_release_stats %}
     <tr>
       <td class="leftcell" style="font-size:120%;">
-        <a href="{% url language_release lang.locale,stat.name %}">{{ stat.description }}</a>
+        {{ stat.description }}</a>
       </td>
   
     {% if stat.doctotal %}
-      <td>{{ stat.doctransperc }}% ({{ stat.doctrans }}/{{ stat.docfuzzy }}/{{ stat.docuntrans }})</td>
+      <td><a href="{% url language_release lang.locale,stat.name,"doc" %}">
+          {{ stat.doctransperc }}% ({{ stat.doctrans }}/{{ stat.docfuzzy }}/{{ stat.docuntrans }})</a>
+      </td>
       <td style="width: 108px; text-align: center;"><div class="graph">
         <div class="translated" style="width:{{ stat.doctransperc }}px;"></div>
         <div class="fuzzy" style="left:{{ stat.doctransperc }}px; width:{{ stat.docfuzzyperc }}px;"></div>
@@ -41,7 +43,9 @@
       <td>-</td><td></td>
     {% endif %}
 
-    <td>{{ stat.uitransperc }}% ({{ stat.uitrans }}/{{ stat.uifuzzy }}/{{ stat.uiuntrans }})</td>
+    <td><a href="{% url language_release lang.locale,stat.name,"ui" %}">
+        {{ stat.uitransperc }}% ({{ stat.uitrans }}/{{ stat.uifuzzy }}/{{ stat.uiuntrans }})</a>
+    </td>
     <td style="width: 108px; text-align: center;"><div class="graph">
       <div class="translated" style="width:{{ stat.uitransperc }}px;"></div>
       <div class="fuzzy" style="left:{{ stat.uitransperc }}px; width:{{ stat.uifuzzyperc }}px;"></div>
@@ -55,7 +59,7 @@
 </table>
 {% endfor %}
 
-<!-- Temporarily deactivated
+{% if not team.fake %}
 <h2>{% trans "Team membership" %}</h2>
 {% for group in mem_groups %}
     <h3>{{ group.title }}</h3>
@@ -81,6 +85,7 @@
       {% endif %}
     {% endif %}
 {% endfor %}
--->
+{% endif %}
+
 </div>
 {% endblock %}

Modified: trunk/templates/vertimus/vertimus_detail.html
==============================================================================
--- trunk/templates/vertimus/vertimus_detail.html	(original)
+++ trunk/templates/vertimus/vertimus_detail.html	Thu Dec 25 21:31:41 2008
@@ -7,6 +7,9 @@
 
 {% block content %}
 <div class="mainpage">
+{% with branch.releases.all.0 as release %} 
+<p align="right"><small><a href="{% url languages.views.language_release language.locale, release.name, domain.dtype %}">{% trans release.description %} - {{ language.get_name }}</a></small></p>
+{% endwith %}
 
 <h1>{{ module.get_description }} - {{ branch.name }} - {% trans domain.description %} - {% trans language %}</h1>
 
@@ -14,11 +17,11 @@
   <p>{{ module.comment|safe }}</p>
 {% else %}
   {% ifnotequal module.vcs_root "http://svn.gnome.org/svn"; %}
-  <p><i><img src="/media/img/warn.png" alt="Warning logo" />{% trans "This module is not part of the GNOME SVN repository. Please check the module's web page to see where to send translations." %}</i></p>
+  <p><i><img src="{{ MEDIA_URL }}img/warn.png" alt="Warning logo" />{% trans "This module is not part of the GNOME SVN repository. Please check the module's web page to see where to send translations." %}</i></p>
   {% endifnotequal %}
 {% endif %}
 
-<h3>State: {{ state }}
+<h3>{% trans "State:" %} {{ state }}
 {% ifnotequal state.name 'none' %}
 ({{ state.updated|date:"D d M Y P" }})
 {% endifnotequal %}
@@ -43,13 +46,10 @@
   <tr>
     <td>{% trans "Translated:" %}</td>
     <td>{{ stats.get_translationstat|safe }}</td>
-  </tr>
-  <tr>
-    <td>{% trans "Graph:" %}</td>
     <td><div class="graph">
         <div class="translated" style="width: {{ stats.tr_percentage }}px;"></div>
-        <div class="fuzzy" style="left:{{ stats.tr_percentage }}px; width:{{ stats.fu_percentage }}px;"></div>
-        <div class="untranslated" style="left:{{ stats.tr_percentage|add:stats.fu_percentage }}px; width: {{ stats.un_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>
   </tr>
@@ -57,27 +57,25 @@
 
 {% if stats.fig_count %}
 <p><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/img/figure.png" alt="{% trans "Display document figures" %}"></a>
+    <img src="{{ MEDIA_URL }}img/figure.png" alt="{% trans "Display document figures" %}"></a>
 </p>
 {% endif %}
 
 {% if action_history %}
-<h3>{% trans "Action History" %}</h3>
+<h2>{% trans "Action History" %}</h2>
 <table>
   {% for action in action_history %}
   <tr>
-    <td>{{ action }}, 
-      <img src="/media/img/person.png" alt="Person"/>
+    <td class="action_head">
+      {{ action.created|date:"Y-m-d H:i" }}, <strong>{{ action }}</strong>,
       <!-- Spam protection -->
-      <a href="{{ action.person.get_absolute_url }}">{{ action.person.name }}</a>
-      {{ action.created }}
+      <img src="{{ MEDIA_URL }}img/person.png" alt="Person"/> <a href="{{ action.person.get_absolute_url }}">{{ action.person.name }}</a>
     </td>
   </tr>
   <tr>
-    <td>
+    <td class="action_content">
       {% if action.file %}
-      {% trans "Uploaded file:" %} <a href="{{ action.file.url }}">{{ action.file.name }}</a>
-        {% if action.comment %}<br/>{% endif %}
+      <div class="uploaded_file">{% trans "File:" %} <a href="{{ action.file.url }}">{{ action.get_filename }}</a></div>
       {% endif %}
       {{ action.comment|linebreaksbr|default:"No comment" }}<br/>
     </td>
@@ -87,11 +85,11 @@
 </table>
 {% endif %}
 
-<h3>{% trans "New Action" %}</h3>
+<h2>{% trans "New Action" %}</h2>
 
 {% if action_form %}
-  <form enctype="multipart/form-data" action="/vertimus/{{ stats.id }}" method="POST">
-    <table>
+  <form enctype="multipart/form-data" action="{% url vertimus-stats-id-view stats.id %}" method="POST">
+    <table class="djform">
       {{ action_form.as_table }}
       <tr><td></td>
         <td><input type="submit" value="Submit"></td><tr>

Modified: trunk/vertimus/models.py
==============================================================================
--- trunk/vertimus/models.py	(original)
+++ trunk/vertimus/models.py	Thu Dec 25 21:31:41 2008
@@ -308,6 +308,10 @@
         return self._action_db.comment
 
     @property
+    def created(self):
+        return self._action_db.created
+
+    @property
     def file(self):
         return self._action_db.file
 
@@ -321,6 +325,12 @@
 
     def __unicode__(self):
         return self.description
+    
+    def get_filename(self):
+        if self._action_db.file:
+            return os.path.basename(self._action_db.file.name)
+        else:
+            return None
 
     def send_mail_new_state(self, old_state, new_state, recipient_list):
         # Remove None items from the list
@@ -545,7 +555,7 @@
                 comment=action_db.comment,
                 file=file_to_backup)
             if file_to_backup:
-                action_db_backup.file.save(os.path.basename(action_db.file.name), file_to_backup, save=False)
+                action_db_backup.file.save(self.get_filename(), file_to_backup, save=False)
             action_db_backup.save()
 
             if sequence == None:



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