Skip to content

Commit d21dd25

Browse files
committed
Show the count of the matching inactive versions
- Only show if the number exceeds the displayed number
1 parent 7cdc6f8 commit d21dd25

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

readthedocs/projects/views/public.py

+2
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ def project_versions(request, project_slug):
385385
version_filter = request.GET.get('version_filter', '')
386386
if version_filter:
387387
inactive_versions = inactive_versions.filter(verbose_name__icontains=version_filter)
388+
total_inactive_versions_count = inactive_versions.count()
388389
inactive_versions = inactive_versions[:max_inactive_versions]
389390

390391
# If there's a wiped query string, check the string against the versions
@@ -406,6 +407,7 @@ def project_versions(request, project_slug):
406407
'active_versions': active_versions,
407408
'project': project,
408409
'max_inactive_versions': max_inactive_versions,
410+
'total_inactive_versions_count': total_inactive_versions_count,
409411
},
410412
)
411413

readthedocs/templates/projects/project_version_list.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ <h1>{% trans "Activate a version" %}</h1>
8383
</div>
8484

8585
{# Version search #}
86-
<a name="version-filter"></a>
8786
<div class="wide-search-bar">
8887
<div class="wide-search-bar-wrapper clearfix">
8988
<form action="." method="GET">
@@ -140,10 +139,10 @@ <h1>{% trans "Activate a version" %}</h1>
140139
</div>
141140
</div>
142141

143-
{% if inactive_versions|length >= max_inactive_versions %}
142+
{% if total_inactive_versions_count > max_inactive_versions %}
144143
<p>
145144
{% blocktrans trimmed %}
146-
Only the first {{ max_inactive_versions }} inactive versions were shown. Please <a href="#version-filter">filter the list</a>.
145+
Showing the first {{ max_inactive_versions }} of {{ total_inactive_versions_count }} inactive versions.</a>.
147146
{% endblocktrans %}
148147
</p>
149148
{% endif %}

0 commit comments

Comments
 (0)