Commit 57f513db authored by Michal Čihař's avatar Michal Čihař

Better formatting of dictionary

parent 6325901c
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load weblate %}
{% load url from future %} {% load url from future %}
{% block breadcums %} {% block breadcums %}
...@@ -8,10 +9,20 @@ ...@@ -8,10 +9,20 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<ul> <table class="sort simple">
<thead>
<tr>
<th>{% trans "Language" %}</th>
<th>{% trans "Words" %}</th>
</tr>
<tbody>
{% for dict in dicts %} {% for dict in dicts %}
<li><a href="{% url 'trans.views.show_dictionary' project=project.slug lang=dict.code %}">{{ dict }}</a></li> <tr>
<th><a href="{% url 'trans.views.show_dictionary' project=project.slug lang=dict.code %}">{{ dict }}</a></th>
<td class="number">{% dictionary_count dict project %}</td>
</tr>
{% endfor %} {% endfor %}
</ul> </tbody>
</table>
{% endblock %} {% endblock %}
...@@ -9,7 +9,7 @@ import re ...@@ -9,7 +9,7 @@ import re
from trans.util import split_plural from trans.util import split_plural
from lang.models import Language from lang.models import Language
from trans.models import Project, SubProject from trans.models import Project, SubProject, Dictionary
import trans.checks import trans.checks
register = template.Library() register = template.Library()
...@@ -74,3 +74,7 @@ def subproject_name(prj, subprj): ...@@ -74,3 +74,7 @@ def subproject_name(prj, subprj):
@register.simple_tag @register.simple_tag
def language_name(code): def language_name(code):
return Language.objects.get(code = code).__unicode__() return Language.objects.get(code = code).__unicode__()
@register.simple_tag
def dictionary_count(lang, project):
return Dictionary.objects.filter(project = project, language = lang).count()
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