Commit 136eb3fe authored by Michal Čihař's avatar Michal Čihař

Subproject display

parent d3948f19
......@@ -5,17 +5,17 @@
{% block breadcums %}
<li><a href="{% url 'trans.views.show_checks' %}">{% trans "checks" %}</a></li>
<li><a href="{% url 'trans.views.show_check' name=check.check %}">{{ check.get_check_display }}</a></li>
<li><a href="{% url 'trans.views.show_check' name=sample.check %}">{{ sample.get_check_display }}</a></li>
{% endblock %}
{% block content %}
<p>
{{ check.get_description }}
{{ sample.get_description }}
</p>
<p>
{% blocktrans with check.get_doc_url as link %}More information about this check is available in the <a href="{{ link }}">documentation</a>.{% endblocktrans %}
{% blocktrans with sample.get_doc_url as link %}More information about this check is available in the <a href="{{ link }}">documentation</a>.{% endblocktrans %}
</p>
<table class="sort simple">
......@@ -27,8 +27,8 @@
<tbody>
{% for check in checks %}
<tr>
<th><a href="{% project_url check.project %}">{% project_name check.project %}</a></th>
<td><a href="{% url 'trans.views.show_check' name=check.check %}">{{ check.count }}</a></td>
<th><a href="{% url 'trans.views.show_project' project=check.project__slug %}">{% project_name check.project__slug %}</a></th>
<td><a href="{% url 'trans.views.show_check_project' name=sample.check project=check.project__slug %}">{{ check.count }}</a></td>
</tr>
{% endfor %}
</tbody>
......
{% extends "base.html" %}
{% load i18n %}
{% load weblate %}
{% load url from future %}
{% block breadcums %}
<li><a href="{% url 'trans.views.show_checks' %}">{% trans "checks" %}</a></li>
<li><a href="{% url 'trans.views.show_check' name=sample.check %}">{{ sample.get_check_display }}</a></li>
<li><a href="{% url 'trans.views.show_check_project' name=sample.check project=project.slug %}">{{ project }}</a></li>
{% endblock %}
{% block content %}
<p>
{{ sample.get_description }}
</p>
<p>
{% blocktrans with sample.get_doc_url as link %}More information about this check is available in the <a href="{{ link }}">documentation</a>.{% endblocktrans %}
</p>
<table class="sort simple">
<thead>
<tr>
<th>{% trans "Project" %}</th>
<th>{% trans "Failures" %}</th>
</tr>
<tbody>
{% for check in checks %}
<tr>
<th><a href="{% url 'trans.views.show_subproject' project=check.translation__subproject__project__slug subproject=check.translation__subproject__slug %}">{% subproject_name check.translation__subproject__project__slug check.translation__subproject__slug %}</a></th>
<td><a href="{% url 'trans.views.show_check_subproject' name=sample.check project=check.translation__subproject__project__slug subproject=check.translation__subproject__slug %}">{{ check.count }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% load weblate %}
{% load url from future %}
{% block breadcums %}
<li><a href="{% url 'trans.views.show_checks' %}">{% trans "checks" %}</a></li>
<li><a href="{% url 'trans.views.show_check' name=sample.check %}">{{ sample.get_check_display }}</a></li>
<li><a href="{% url 'trans.views.show_check_project' name=sample.check project=subproject.project.slug %}">{{ subproject.project }}</a></li>
<li><a href="{% url 'trans.views.show_check_subproject' name=sample.check project=subproject.project.slug subproject=subproject.slug %}">{{ subproject }}</a></li>
{% endblock %}
{% block content %}
<p>
{{ sample.get_description }}
</p>
<p>
{% blocktrans with sample.get_doc_url as link %}More information about this check is available in the <a href="{{ link }}">documentation</a>.{% endblocktrans %}
</p>
<table class="sort simple">
<thead>
<tr>
<th>{% trans "Translation" %}</th>
<th>{% trans "Failures" %}</th>
</tr>
<tbody>
{% for check in checks %}
<tr>
<th><a href="{% url 'trans.views.show_translation' project=subproject.project.slug subproject=subproject.slug lang=check.translation__language__code %}">{{ check.translation__language__code }}</a></th>
<td><a href="{% url 'trans.views.translate' project=subproject.project.slug subproject=subproject.slug lang=check.translation__language__code %}?type={{ sample.check }}">{{ check.count }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
......@@ -9,7 +9,7 @@ import re
from trans.util import split_plural
from lang.models import Language
from trans.models import Project
from trans.models import Project, SubProject
import trans.checks
register = template.Library()
......@@ -65,8 +65,8 @@ def check_description(check):
@register.simple_tag
def project_name(prj):
return Project.objects.get(pk = prj).name
return Project.objects.get(slug = prj).__unicode__()
@register.simple_tag
def project_url(prj):
return Project.objects.get(pk = prj).get_absolute_url()
def subproject_name(prj, subprj):
return SubProject.objects.get(project__slug = prj, slug = subprj).__unicode__()
......@@ -63,9 +63,31 @@ def show_checks(request):
def show_check(request, name):
sample = Check.objects.filter(check = name)[0]
return render_to_response('check.html', RequestContext(request, {
'checks': Check.objects.filter(check = name).values('project').annotate(count = Count('id')),
'checks': Check.objects.filter(check = name).values('project__slug').annotate(count = Count('id')),
'title': sample.get_check_display(),
'check': sample,
'sample': sample,
}))
def show_check_project(request, name, project):
prj = get_object_or_404(Project, slug = project)
checks = Check.objects.filter(check = name, project = prj).values_list('checksum', flat = True)
sample = Check.objects.filter(check = name, project = prj)[0]
return render_to_response('check_project.html', RequestContext(request, {
'checks': Unit.objects.filter(checksum__in = checks).values('translation__subproject__slug', 'translation__subproject__project__slug').annotate(count = Count('id')),
'title': '%s/%s' % (prj.__unicode__(), sample.get_check_display()),
'sample': sample,
'project': prj,
}))
def show_check_subproject(request, name, project, subproject):
subprj = get_object_or_404(SubProject, slug = subproject, project__slug = project)
checks = Check.objects.filter(check = name, project = subprj.project).values_list('checksum', flat = True)
sample = Check.objects.filter(check = name, project = subprj.project)[0]
return render_to_response('check_subproject.html', RequestContext(request, {
'checks': Unit.objects.filter(translation__subproject = subprj, checksum__in = checks).values('translation__language__code').annotate(count = Count('id')),
'title': '%s/%s' % (subprj.__unicode__(), sample.get_check_display()),
'sample': sample,
'subproject': subprj,
}))
def show_languages(request):
......
......@@ -34,6 +34,8 @@ urlpatterns = patterns('',
url(r'^checks/$', 'trans.views.show_checks'),
url(r'^checks/(?P<name>[^/]*)/$', 'trans.views.show_check'),
url(r'^checks/(?P<name>[^/]*)/(?P<project>[^/]*)/$', 'trans.views.show_check_project'),
url(r'^checks/(?P<name>[^/]*)/(?P<project>[^/]*)/(?P<subproject>[^/]*)/$', 'trans.views.show_check_subproject'),
url(r'^hooks/p/(?P<project>[^/]*)/(?P<subproject>[^/]*)/update/$', 'trans.api.update_subproject'),
url(r'^hooks/github/$', 'trans.api.github_hook'),
......
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