Commit 35cc73af authored by Michal Čihař's avatar Michal Čihař

Allow to directly edit priority from translation

This makes it easy to adjust it when something wrong is noticed while
translating.

Fixes #575
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 9821c691
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
{% for source in page_obj.object_list %} {% for source in page_obj.object_list %}
{% with source.get_source_comments as comments %} {% with source.get_source_comments as comments %}
<tr> <tr>
<td class="expander"> <td class="expander {% if expand %}auto-expand{% endif %}">
<a><span class="glyphicon glyphicon-chevron-right expand-icon"></span></a> <a><span class="glyphicon glyphicon-chevron-right expand-icon"></span></a>
</td> </td>
<td class="translatetext expander">{% format_translation source.source %}</td> <td class="translatetext expander">{% format_translation source.source %}</td>
<td>{{ source.source_info.get_priority_display }}{% if perms.edit_priority %} <a class="button smallbutton edit-priority" href="{% url 'edit_priority' pk=source.source_info.pk %}" data-priority="{{ source.source_info.priority }}"><span class="glyphicon glyphicon-pencil"></span></a>{% endif %}</td> <td>{{ source.source_info.get_priority_display }}{% if perms.trans.edit_priority %} <a class="button smallbutton edit-priority" href="{% url 'edit_priority' pk=source.source_info.pk %}" data-priority="{{ source.source_info.priority }}"><span class="glyphicon glyphicon-pencil"></span></a>{% endif %}</td>
<td class="source-checks"> <td class="source-checks">
{% if ignored %} {% if ignored %}
{% show_checks source.source_checks user %} {% show_checks source.source_checks user %}
......
...@@ -389,7 +389,10 @@ ...@@ -389,7 +389,10 @@
<th>{% trans "String priority" %}</th> <th>{% trans "String priority" %}</th>
</tr> </tr>
<tr> <tr>
<td>{{ unit.source_info.get_priority_display }}</td> <td>
{{ unit.source_info.get_priority_display }}
{% if perms.trans.edit_priority %} <a class="button smallbutton" href="{% url 'review_source' project=unit.translation.subproject.project.slug subproject=unit.translation.subproject.slug %}?checksum={{ unit.checksum }}"><span class="glyphicon glyphicon-pencil"></span></a>{% endif %}
</td>
</tr> </tr>
{% with unit.active_source_checks as checks %} {% with unit.active_source_checks as checks %}
{% if checks %} {% if checks %}
......
...@@ -299,6 +299,11 @@ $(function () { ...@@ -299,6 +299,11 @@ $(function () {
$(this).closest('tr').find('.expander').first().click(); $(this).closest('tr').find('.expander').first().click();
}); });
/* Auto expand expander */
$('.auto-expand').each(function () {
$(this).click()
});
/* Load correct tab */ /* Load correct tab */
if (location.hash !== '') { if (location.hash !== '') {
var activeTab = $('[data-toggle=tab][href=' + location.hash + ']'); var activeTab = $('[data-toggle=tab][href=' + location.hash + ']');
......
...@@ -48,9 +48,15 @@ def review_source(request, project, subproject): ...@@ -48,9 +48,15 @@ def review_source(request, project, subproject):
rqtype = request.GET.get('type', 'all') rqtype = request.GET.get('type', 'all')
limit = request.GET.get('limit', 50) limit = request.GET.get('limit', 50)
page = request.GET.get('page', 1) page = request.GET.get('page', 1)
checksum = request.GET.get('checksum', '')
ignored = 'ignored' in request.GET ignored = 'ignored' in request.GET
expand = False
# Filter units: # Filter units:
if checksum:
sources = source.unit_set.filter(checksum=checksum)
expand = True
else:
sources = source.unit_set.filter_type(rqtype, source, ignored) sources = source.unit_set.filter_type(rqtype, source, ignored)
paginator = Paginator(sources, limit) paginator = Paginator(sources, limit)
...@@ -73,6 +79,7 @@ def review_source(request, project, subproject): ...@@ -73,6 +79,7 @@ def review_source(request, project, subproject):
'page_obj': sources, 'page_obj': sources,
'rqtype': rqtype, 'rqtype': rqtype,
'ignored': ignored, 'ignored': ignored,
'expand': True,
'title': _('Review source strings in %s') % obj.__unicode__(), 'title': _('Review source strings in %s') % obj.__unicode__(),
} }
) )
......
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