Commit c6aa6ce0 authored by Michal Čihař's avatar Michal Čihař

Improve listing of translations

- show number of suggestions
- add links to suggestions and fuzzy strings
- move link to checks from separate field to check count
parent 6ee699da
...@@ -8,27 +8,47 @@ ...@@ -8,27 +8,47 @@
<th colspan="2">{% trans "Translated" %}</th> <th colspan="2">{% trans "Translated" %}</th>
<th>{% trans "Fuzzy" context "Number of fuzzy strings" %}</th> <th>{% trans "Fuzzy" context "Number of fuzzy strings" %}</th>
<th>{% trans "Checks" context "Number of failing checks" %}</th> <th>{% trans "Checks" context "Number of failing checks" %}</th>
<th></th> <th>{% trans "Suggestions" context "Number of suggestions" %}</th>
<th></th> <th></th>
</tr> </tr>
<tbody> <tbody>
{% for trans in translations %} {% for trans in translations %}
{% with trans.get_translated_percent as percent and trans.get_fuzzy_percent as fuzzy and trans.get_failing_checks as checks and trans.get_non_translated as count and trans.get_failing_checks_percent as check_percent %} {% with trans.get_translated_percent as percent and trans.get_fuzzy_percent as fuzzy and trans.get_failing_checks as checks and trans.get_non_translated as count and trans.get_failing_checks_percent as check_percent and trans.get_suggestions_count as suggestions%}
<tr> <tr>
<th><a href="{{ trans.get_absolute_url }}">{% if show_language == 1 %}{{ trans.language }}{% else %}{{ trans.subproject }}{% if show_language == 2 %} ({{ trans.language }}){% endif %}{% endif %}</a></th> <th><a href="{{ trans.get_absolute_url }}">{% if show_language == 1 %}{{ trans.language }}{% else %}{{ trans.subproject }}{% if show_language == 2 %} ({{ trans.language }}){% endif %}{% endif %}</a></th>
<td>{% if trans.is_user_locked %}<span class="ui-icon ui-icon-locked tooltip">{{ trans.get_lock_display }}</span>{% endif %}</td> <td>{% if trans.is_user_locked %}<span class="ui-icon ui-icon-locked tooltip">{{ trans.get_lock_display }}</span>{% endif %}</td>
<td class="progress"><div class="progress" value="{{ percent|floatformat:0 }}" fuzzy="{{ fuzzy|floatformat:0 }}" checks="{{ check_percent|floatformat:0 }}"></div></td> <td class="progress"><div class="progress" value="{{ percent|floatformat:0 }}" fuzzy="{{ fuzzy|floatformat:0 }}" checks="{{ check_percent|floatformat:0 }}"></div></td>
<td class="percent">{{ percent }}%</td> <td class="percent">{{ percent }}%</td>
<td class="percent">{{ fuzzy }}%</td> <td class="percent">
<td class="number">{{ checks }}</td> {% if fuzzy > 0 %}
<td> <a href="{{ trans.get_translate_url }}?type=fuzzy" title="{% blocktrans count fuzzy as count %}There is {{ count }} fuzzy string.{% plural %}There are {{ count }} fuzzy strings.{% endblocktrans %}">
{% if count > 0 %} {{ fuzzy }}%
<a href="{{ trans.get_translate_url }}?type=untranslated" title="{% blocktrans count trans.get_non_translated as count %}There is {{ count }} not translated string.{% plural %}There are {{ count }} not translated strings.{% endblocktrans %}">{% trans "Translate" %}</a> </a>
{% else %}
{{ fuzzy }}%
{% endif %} {% endif %}
</td> </td>
<td> <td class="number">
{% if checks > 0 %} {% if checks > 0 %}
<a href="{{ trans.get_translate_url }}?type=allchecks" title="{% blocktrans count checks as count %}There is {{ count }} failing check.{% plural %}There are {{ count }} failing checks.{% endblocktrans %}">{% trans "Review" %}</a> <a href="{{ trans.get_translate_url }}?type=allchecks" title="{% blocktrans count checks as count %}There is {{ count }} failing check.{% plural %}There are {{ count }} failing checks.{% endblocktrans %}">
{{ checks }}
</a>
{% else %}
{{ checks }}
{% endif %}
</td>
<td class="number">
{% if suggestions > 0 %}
<a href="{{ trans.get_translate_url }}?type=suggestions" title="{% blocktrans count suggestions as count %}There is {{ count }} suggestion.{% plural %}There are {{ count }} suggestions.{% endblocktrans %}">
{{ suggestions }}
</a>
{% else %}
{{ suggestions }}
{% endif %}
</td>
<td>
{% if count > 0 %}
<a href="{{ trans.get_translate_url }}?type=untranslated" title="{% blocktrans count trans.get_non_translated as count %}There is {{ count }} not translated string.{% plural %}There are {{ count }} not translated strings.{% endblocktrans %}">{% trans "Translate" %}</a>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
......
...@@ -2115,6 +2115,12 @@ class Translation(models.Model): ...@@ -2115,6 +2115,12 @@ class Translation(models.Model):
return ret return ret
def get_suggestions_count(self):
'''
Returns number of units with suggestions.
'''
return self.unit_set.count_type('suggestions', self)
def get_failing_checks(self, check='allchecks'): def get_failing_checks(self, check='allchecks'):
''' '''
Returns number of units with failing checks. Returns number of units with failing checks.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment