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

Check page no longer needs sample

parent 3e1ee21d
......@@ -5,19 +5,21 @@
{% 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' name=check.check_id %}">{{ check.name }}</a></li>
{% endblock %}
{% block content %}
<p>
{{ sample.get_description }}
{{ check.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 %}
{% blocktrans with check.get_doc_url as link %}More information about this check is available in the <a href="{{ link }}">documentation</a>.{% endblocktrans %}
</p>
{% if checks %}
<table class="sort simple">
<thead>
<tr>
......@@ -28,11 +30,16 @@
{% for check in checks %}
<tr>
<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>
<td><a href="{% url 'trans.views.show_check_project' name=check.check_id project=check.project__slug %}">{{ check.count }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>
{% trans "There are no matching failed checks!" %}
</p>
{% endif %}
{% endblock %}
......@@ -5,20 +5,21 @@
{% 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>
<li><a href="{% url 'trans.views.show_check' name=check.check_id %}">{{ check.name }}</a></li>
<li><a href="{% url 'trans.views.show_check_project' name=check.check_id project=project.slug %}">{{ project }}</a></li>
{% endblock %}
{% block content %}
<p>
{{ sample.get_description }}
{{ check.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 %}
{% blocktrans with check.get_doc_url as link %}More information about this check is available in the <a href="{{ link }}">documentation</a>.{% endblocktrans %}
</p>
{% if checks %}
<table class="sort simple">
<thead>
<tr>
......@@ -29,11 +30,16 @@
{% 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>
<td><a href="{% url 'trans.views.show_check_subproject' name=check.check_id project=check.translation__subproject__project__slug subproject=check.translation__subproject__slug %}">{{ check.count }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>
{% trans "There are no matching failed checks!" %}
</p>
{% endif %}
{% endblock %}
......
......@@ -5,21 +5,22 @@
{% 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.name }}</a></li>
<li><a href="{% url 'trans.views.show_check' name=check.check_id %}">{{ check.name }}</a></li>
<li><a href="{% url 'trans.views.show_check_project' name=check.check_id project=subproject.project.slug %}">{{ subproject.project }}</a></li>
<li><a href="{% url 'trans.views.show_check_subproject' name=check.check_id project=subproject.project.slug subproject=subproject.slug %}">{{ subproject.name }}</a></li>
{% endblock %}
{% block content %}
<p>
{{ sample.get_description }}
{{ check.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 %}
{% blocktrans with check.get_doc_url as link %}More information about this check is available in the <a href="{{ link }}">documentation</a>.{% endblocktrans %}
</p>
{% if checks %}
<table class="sort simple">
<thead>
<tr>
......@@ -30,11 +31,16 @@
{% 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 %}">{% language_name 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>
<td><a href="{% url 'trans.views.translate' project=subproject.project.slug subproject=subproject.slug lang=check.translation__language__code %}?type={{ check.check_id }}">{{ check.count }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>
{% trans "There are no matching failed checks!" %}
</p>
{% endif %}
{% endblock %}
......
......@@ -14,6 +14,7 @@ from django.core.urlresolvers import reverse
from trans.models import Project, SubProject, Translation, Unit, Suggestion, Check, Dictionary, Change
from lang.models import Language
import trans.checks
from trans.forms import TranslationForm, UploadForm, SimpleUploadForm, ExtraUploadForm, SearchForm, MergeForm, AutoForm, WordForm, DictUploadForm, ReviewForm
from util import join_plural
from accounts.models import Profile
......@@ -79,14 +80,14 @@ def show_check(request, name):
Details about failing check.
'''
try:
sample = Check.objects.filter(check = name, ignore = False)[0]
check = trans.checks.CHECKS[name]
except IndexError:
raise Http404('No check matches the given query.')
return render_to_response('check.html', RequestContext(request, {
'checks': Check.objects.filter(check = name, ignore = False).values('project__slug').annotate(count = Count('id')),
'title': sample.get_check_display(),
'sample': sample,
'title': check.name,
'check': check,
}))
def show_check_project(request, name, project):
......@@ -95,7 +96,7 @@ def show_check_project(request, name, project):
'''
prj = get_object_or_404(Project, slug = project)
try:
sample = Check.objects.filter(check = name, project = prj, ignore = False)[0]
check = trans.checks.CHECKS[name]
except IndexError:
raise Http404('No check matches the given query.')
langs = Check.objects.filter(check = name, project = prj, ignore = False).values_list('language', flat = True).distinct()
......@@ -106,8 +107,8 @@ def show_check_project(request, name, project):
units |= res
return render_to_response('check_project.html', RequestContext(request, {
'checks': units,
'title': '%s/%s' % (prj.__unicode__(), sample.get_check_display()),
'sample': sample,
'title': '%s/%s' % (prj.__unicode__(), check.name),
'check': check,
'project': prj,
}))
......@@ -117,7 +118,7 @@ def show_check_subproject(request, name, project, subproject):
'''
subprj = get_object_or_404(SubProject, slug = subproject, project__slug = project)
try:
sample = Check.objects.filter(check = name, project = subprj.project, ignore = False)[0]
check = trans.checks.CHECKS[name]
except IndexError:
raise Http404('No check matches the given query.')
langs = Check.objects.filter(check = name, project = subprj.project, ignore = False).values_list('language', flat = True).distinct()
......@@ -128,8 +129,8 @@ def show_check_subproject(request, name, project, subproject):
units |= res
return render_to_response('check_subproject.html', RequestContext(request, {
'checks': units,
'title': '%s/%s' % (subprj.__unicode__(), sample.get_check_display()),
'sample': sample,
'title': '%s/%s' % (subprj.__unicode__(), check.name),
'check': check,
'subproject': subprj,
}))
......
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