Skip to content

Commit d98329c

Browse files
authored
Add Visit docs button to header (#508)
This gives a basic way to get to the docs like the old dashboard. I was doing a bunch of local dev on the new dashboard and kept getting annoyed at not being able to get to the docs in an obvious way. I think this is important and is a middle ground until we can work on a fancier verison. <img width="939" alt="Screenshot 2024-10-15 at 7 21 13 AM" src="https://github.com/user-attachments/assets/a701d20e-3965-4232-9360-7a93795f41ec">
1 parent 381b2b7 commit d98329c

File tree

1 file changed

+14
-5
lines changed
  • readthedocsext/theme/templates/projects/partials

1 file changed

+14
-5
lines changed

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
style="display: none">
5050

5151
{% block project_header_description %}
52-
{% if project.description %}<p>{{ project.description|truncatewords:15 }}</p>{% endif %}
52+
{% if project.description %}
53+
<p>{{ project.description|truncatewords:15 }}</p>
54+
{% endif %}
5355
{% endblock project_header_description %}
5456

5557
{% block project_header_tags %}
@@ -171,8 +173,8 @@
171173
{% trans "Builds" %}
172174
<span class="ui tiny teal circular label">{{ project.builds.count }}</span>
173175
</a>
174-
{% if request.user|is_admin:project %}
175-
<div class="right menu">
176+
<div class="right menu">
177+
{% if request.user|is_admin:project %}
176178
{% if user.is_staff %}
177179
<a class="item" data-bind="click: $root.show_modal('project-debug')">
178180
<i class="fa-duotone fa-microscope icon"></i>
@@ -184,8 +186,15 @@
184186
<i class="fa-duotone fa-gears icon"></i>
185187
{% trans "Settings" %}
186188
</a>
187-
</div>
188-
{% endif %}
189+
{% endif %}
190+
{# Show top-level view docs button on non-build pages with a good build #}
191+
{% if project.has_good_build and not build %}
192+
<a class="item" href="{{ project.get_docs_url }}">
193+
<i class="fa-duotone fa-book icon"></i>
194+
{% trans "View docs" %}
195+
</a>
196+
{% endif %}
197+
</div>
189198
</div>
190199

191200
<div class="ui mini modal" data-modal-id="project-debug">

0 commit comments

Comments
 (0)