Skip to content

Commit

Permalink
ui: Add approved percentage to the object listing
Browse files Browse the repository at this point in the history
Only shows if reviews are enabled in the project.

A simpler implementation compared to MR WeblateOrg#9864.

Resolves WeblateOrg#9855
  • Loading branch information
michael-smt committed Sep 19, 2023
1 parent 54193a4 commit f328d9a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Not yet released.
**New features**

**Improvements**
* :ref:`project-translation_review` also shows the approval percentage in object listings.

**Bug fixes**

Expand Down
7 changes: 7 additions & 0 deletions weblate/static/style-bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,13 @@ input.color_edit:checked + label {
}
}

@media (max-width: 540px) {
.zero-width-540 {
display: none;
width: 0;
}
}

.editor-footer {
z-index: 999;
position: relative;
Expand Down
18 changes: 18 additions & 0 deletions weblate/templates/snippets/list-objects.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@
</a>
{% endif %}
</th>
{% if project and project.enable_review %}
<th title="{% trans "Sort this column" %}" class="number zero-width-540 sort-cell">
{% if objects.paginator.num_pages > 1 %}
<a href="?page={{ objects.number }}&amp;sort_by={% if objects.paginator.sort_by == "approved" %}-{% endif %}approved">
{% endif %}
{% trans "Approved" %}
<span class="sort-icon {% if objects.paginator.sort_by == "approved" %}sort-down{% elif objects.paginator.sort_by == "-approved" %}sort-up{% endif %}" />
{% if objects.paginator.num_pages > 1 %}
</a>
{% endif %}
</th>
{% endif %}
<th title="{% trans "Sort this column" %}" class="number sort-cell">
{% if objects.paginator.num_pages > 1 %}
<a href="?page={{ objects.number }}&amp;sort_by={% if objects.paginator.sort_by == "translated" %}-{% endif %}translated">
Expand Down Expand Up @@ -140,6 +152,9 @@
<th class="object-link">
<a href="{{ category.get_absolute_url }}">{{ category.name }}</a>
</th>
{% if project and project.enable_review %}
{% include "snippets/list-objects-percent.html" with percent=category.stats.approved_percent value=category.stats.approved query="q=state:>=approved" all=category.stats.all class="zero-width-540" %}
{% endif %}
{% include "snippets/list-objects-percent.html" with percent=category.stats.translated_percent value=category.stats.translated query="q=state:>=translated" all=category.stats.all %}
{% if not hide_details %}
{% include "snippets/list-objects-number.html" with value=category.stats.todo query="q=state:<translated" class="zero-width-640" %}
Expand Down Expand Up @@ -225,6 +240,9 @@
{% endif %}
{% indicate_alerts object %}
</th>
{% if project and project.enable_review %}
{% include "snippets/list-objects-percent.html" with percent=object.stats.approved_percent value=object.stats.approved query="q=state:>=approved" all=object.stats.all class="zero-width-540" %}
{% endif %}
{% if is_glossary %}
{% include "snippets/list-objects-number.html" with value=object.stats.translated query="q=state:>=translated" show_zero=True %}
{% else %}
Expand Down

0 comments on commit f328d9a

Please sign in to comment.