Skip to content

Commit 9e5a0f6

Browse files
authored
Fixes for project listing and prefetched latest build (#607)
- Adds display for actively building versions in project listing ![Image](https://github.com/user-attachments/assets/3d046fac-2a7c-4ee6-9000-19f4d19f8a4e) - Fixes bug around usage of `Project.get_latest_build` without `Project.objects.prefetch_latest_build()` -- see readthedocs/readthedocs.org#11840 ---- - Fixes readthedocs/readthedocs.org#11840 - Refs readthedocs/readthedocs.org#12225
1 parent f614f83 commit 9e5a0f6

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

readthedocsext/theme/templates/projects/partials/project_list.html

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,35 @@
5252
{% block list_item_header %}
5353
<a href="{% url "projects_detail" object.slug %}">{{ object.name }}</a>
5454
<div class="sub header">
55-
{% if object.has_good_build %}
56-
{% with build=object.get_latest_build %}
55+
{% with build=object.get_latest_build %}
56+
{% if build %}
5757
<time data-content="{{ build.date }}">
58-
{# Translators: this will read like "Last built 1 year, 5 months ago" #}
59-
{% blocktrans with time_since=build.date|naturaltime trimmed %}
60-
Last built {{ time_since }}
61-
{% endblocktrans %}
58+
{% if build.finished %}
59+
{# Translators: this will read like "Last built 1 year, 5 months ago" #}
60+
{% blocktrans with time_since=build.date|naturaltime trimmed %}
61+
Last built {{ time_since }}
62+
{% endblocktrans %}
63+
{% else %}
64+
{# Translators: this will read like "Build started 5 minutes ago" #}
65+
{% blocktrans with time_since=build.date|naturaltime trimmed %}
66+
Build started {{ time_since }}
67+
{% endblocktrans %}
68+
{% endif %}
6269
</time>
63-
{% endwith %}
64-
{% else %}
65-
{% trans "Not built yet" %}
66-
{% endif %}
70+
{% else %}
71+
{% trans "Not built yet" %}
72+
{% endif %}
73+
{% endwith %}
6774
</div>
6875
{% endblock list_item_header %}
6976

7077
{% block list_item_meta %}
7178
{% endblock list_item_meta %}
7279

7380
{% block list_item_extra_items %}
74-
{% if object.has_good_build %}
75-
{% with build=object.get_latest_build %}
76-
{# Safety check, there seems to be some case where `has_good_build` and `get_latest_build` still return a null build #}
77-
{% if build %}
78-
{% include "includes/elements/chips/build.html" with project=object build=build %}
79-
{% endif %}
80-
{% endwith %}
81-
{% endif %}
81+
{% with build=object.get_latest_build %}
82+
{% if build %}
83+
{% include "includes/elements/chips/build.html" with project=object build=build %}
84+
{% endif %}
85+
{% endwith %}
8286
{% endblock list_item_extra_items %}

0 commit comments

Comments
 (0)