Skip to content

Improve the version listview #6224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions readthedocs/projects/views/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,14 @@ def project_versions(request, project_slug):
only_active=False,
)
active_versions = versions.filter(active=True)

# Limit inactive versions in case a project has a large number of branches or tags
# Filter inactive versions based on the query string
inactive_versions = versions.filter(active=False)
version_filter = request.GET.get('version_filter', '')
if version_filter:
inactive_versions = inactive_versions.filter(verbose_name__icontains=version_filter)
inactive_versions = inactive_versions[:100]

# If there's a wiped query string, check the string against the versions
# list and display a success message. Deleting directories doesn't know how
Expand Down
19 changes: 17 additions & 2 deletions readthedocs/templates/projects/project_version_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,22 @@ <h1>{% trans "Active Versions" %}</h1>

{% if inactive_versions %}
<div class="module-header">
<h1>{% trans "Inactive Versions" %}</h1>
<h1>{% trans "Activate a version" %}</h1>
<p>{% trans "Active versions are built whenever new code is pushed to that branch or tag." %}</p>
</div>

{# Version search #}
<div class="wide-search-bar">
<div class="wide-search-bar-wrapper clearfix">
<form action="." method="GET">
<div class="text-input-wrapper">
<input type="text" name="version_filter" value="{{ request.GET.version_filter }}" placeholder="1.0, 2.0, devel">
</div>
<div class="submit-input-wrapper">
<input type="submit" value="{% trans 'Filter Inactive Versions' %}">
</div>
</form>
</div>
</div>

<div class="module-list">
Expand All @@ -104,7 +119,7 @@ <h1>{% trans "Inactive Versions" %}</h1>

{% if request.user|is_admin:project %}
<ul class="module-item-menu">
<li><a href="{% url "project_version_detail" project.slug version.slug %}">{% trans "Edit" %}</a></li>
<li><a href="{% url "project_version_detail" project.slug version.slug %}">{% trans "Edit & Activate" %}</a></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the "Edit & Activate" label for the button, but I do not have a better one. Do you think that just "Edit" as it was does not communicate it properly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might have the same feeling. The phrase sounds overly specific for a user. Technically, from our perspective, they are editing and activating, but to the user, they are just activating. I think "Activate" is the most correct descriptor for what the user is looking to accomplish, we can gloss over the fact that it drops into a form.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll update it.

</ul>
{% endif %}

Expand Down