Skip to content

Commit 3f33541

Browse files
committed
Show message if version list truncated
1 parent af4ef4f commit 3f33541

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

readthedocs/projects/views/public.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ def project_versions(request, project_slug):
349349
350350
Shows the available versions and lets the user choose which ones to build.
351351
"""
352+
max_inactive_versions = 100
353+
352354
project = get_object_or_404(
353355
Project.objects.protected(request.user),
354356
slug=project_slug,
@@ -367,7 +369,7 @@ def project_versions(request, project_slug):
367369
version_filter = request.GET.get('version_filter', '')
368370
if version_filter:
369371
inactive_versions = inactive_versions.filter(verbose_name__icontains=version_filter)
370-
inactive_versions = inactive_versions[:100]
372+
inactive_versions = inactive_versions[:max_inactive_versions]
371373

372374
# If there's a wiped query string, check the string against the versions
373375
# list and display a success message. Deleting directories doesn't know how
@@ -387,6 +389,7 @@ def project_versions(request, project_slug):
387389
'inactive_versions': inactive_versions,
388390
'active_versions': active_versions,
389391
'project': project,
392+
'max_inactive_versions': max_inactive_versions,
390393
},
391394
)
392395

readthedocs/templates/projects/project_version_list.html

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

8585
{# Version search #}
86+
<a name="version-filter"></a>
8687
<div class="wide-search-bar">
8788
<div class="wide-search-bar-wrapper clearfix">
8889
<form action="." method="GET">
@@ -134,8 +135,19 @@ <h1>{% trans "Activate a version" %}</h1>
134135
</div>
135136
{% endif %}
136137

138+
139+
137140
</div>
138141
</div>
142+
143+
{% if inactive_versions|length >= max_inactive_versions %}
144+
<p>
145+
{% blocktrans trimmed %}
146+
Only the first {{ max_inactive_versions }} inactive versions were shown. Please <a href="#version-filter">filter the list</a>.
147+
{% endblocktrans %}
148+
</p>
149+
{% endif %}
150+
139151
{% endif %}
140152

141153
</div>

0 commit comments

Comments
 (0)