Skip to content

Commit 098db3d

Browse files
authored
Merge pull request #6276 from readthedocs/davidfischer/version-truncated-message
Show message if version list truncated
2 parents 60fb1a3 + d21dd25 commit 098db3d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

readthedocs/projects/views/public.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ def project_versions(request, project_slug):
367367
368368
Shows the available versions and lets the user choose which ones to build.
369369
"""
370+
max_inactive_versions = 100
371+
370372
project = get_object_or_404(
371373
Project.objects.protected(request.user),
372374
slug=project_slug,
@@ -385,7 +387,8 @@ def project_versions(request, project_slug):
385387
version_filter = request.GET.get('version_filter', '')
386388
if version_filter:
387389
inactive_versions = inactive_versions.filter(verbose_name__icontains=version_filter)
388-
inactive_versions = inactive_versions[:100]
390+
total_inactive_versions_count = inactive_versions.count()
391+
inactive_versions = inactive_versions[:max_inactive_versions]
389392

390393
# If there's a wiped query string, check the string against the versions
391394
# list and display a success message. Deleting directories doesn't know how
@@ -405,6 +408,8 @@ def project_versions(request, project_slug):
405408
'inactive_versions': inactive_versions,
406409
'active_versions': active_versions,
407410
'project': project,
411+
'max_inactive_versions': max_inactive_versions,
412+
'total_inactive_versions_count': total_inactive_versions_count,
408413
},
409414
)
410415

readthedocs/templates/projects/project_version_list.html

+11
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,19 @@ <h1>{% trans "Activate a version" %}</h1>
134134
</div>
135135
{% endif %}
136136

137+
138+
137139
</div>
138140
</div>
141+
142+
{% if total_inactive_versions_count > max_inactive_versions %}
143+
<p>
144+
{% blocktrans trimmed %}
145+
Showing the first {{ max_inactive_versions }} of {{ total_inactive_versions_count }} inactive versions.</a>.
146+
{% endblocktrans %}
147+
</p>
148+
{% endif %}
149+
139150
{% endif %}
140151

141152
</div>

0 commit comments

Comments
 (0)