Files
Dashboard_Projects_Management/projects/templates/projects/docs_home.html
T

29 lines
4.0 KiB
HTML

{% extends 'core/base.html' %}
{% block content %}
<div class="d-flex justify-content-between align-items-start gap-3 flex-wrap mb-3">
<div><a href="{% url 'projects:board' project.id %}">← {{ project.name }}</a><h1 class="mt-2">Documentation</h1><p class="text-muted">Read-only Markdown from the project's Git repository.</p></div>
{% if can_edit and project.git_repository_url %}<form method="post" action="{% url 'projects:docs_refresh' project.id %}">{% csrf_token %}<button class="btn btn-outline-primary">Refresh from Git</button></form>{% endif %}
</div>
<div class="alert {% if sync.last_error %}alert-warning{% else %}alert-secondary{% endif %}" role="status">
<strong>{{ sync_status }}</strong>
{% if sync.indexed_commit %}<span class="d-block">Indexed commit: <code>{{ sync.indexed_commit }}</code>{% if sync.branch %} · {{ sync.branch }}{% endif %}{% if sync.commit_time %} · committed {{ sync.commit_time }}{% endif %}{% if sync.last_success_at %} · fetched {{ sync.last_success_at }}{% endif %}</span>{% endif %}
{% if sync.remote_head and sync.remote_head != sync.indexed_commit %}<span class="d-block">Last observed remote HEAD: <code>{{ sync.remote_head }}</code></span>{% endif %}
{% if sync.last_attempt_at %}<span class="d-block">Last fetch attempt: {{ sync.last_attempt_at }}</span>{% endif %}
<span class="d-block">Documentation accuracy audit: {{ audit_label }}.</span>
</div>
{% if not project.git_repository_url %}<p>No repository is configured. {% if can_edit %}Add its HTTPS Git URL in <a href="{% url 'projects:edit' project.id %}">project settings</a>.{% else %}Ask a project editor to configure its Git URL.{% endif %}</p>{% endif %}
<form method="get" action="{% url 'projects:docs_home' project.id %}" role="search" class="mb-4">
<label for="docs-search" class="form-label">Search documentation</label>
<div class="input-group"><input id="docs-search" class="form-control" name="q" value="{{ query }}" maxlength="200" placeholder="Path, heading or text"><button class="btn btn-outline-secondary">Search</button></div>
</form>
<div class="row g-4">
<nav class="col-md-4 col-lg-3" aria-label="Documentation folders"><h2 class="h5">Folders</h2><ul class="list-unstyled"><li><a href="{% url 'projects:docs_home' project.id %}">All documents</a></li></ul>{% include 'projects/_docs_folder_tree.html' with nodes=folder_tree %}</nav>
<section class="col-md-8 col-lg-9" aria-label="Document results">
<h2 class="h5">{% if query %}Search results{% elif prefix %}{{ prefix }}/{% else %}Documents{% endif %} <small class="text-muted">({{ total }})</small></h2>
{% if documents %}<ul class="list-group">{% if query %}{% for result in results %}<li class="list-group-item"><a href="{% url 'projects:docs_document' project.id result.document.path %}"><strong>{{ result.document.title }}</strong></a><br><small class="text-muted">{{ result.document.path }}</small><p class="mb-0 mt-1">{{ result.snippet }}</p></li>{% endfor %}{% else %}{% for document in documents %}<li class="list-group-item"><a href="{% url 'projects:docs_document' project.id document.path %}"><strong>{{ document.title }}</strong></a><br><small class="text-muted">{{ document.path }}</small></li>{% endfor %}{% endif %}</ul>
{% else %}<p>{% if query %}No matching documents.{% elif sync.last_error %}No indexed documents are available. The latest Git fetch failed.{% elif project.git_repository_url %}No Markdown documentation has been indexed yet.{% else %}Add a repository to begin.{% endif %}</p>{% endif %}
{% if has_previous or has_next %}<nav class="mt-3" aria-label="Document pages">{% if has_previous %}<a class="btn btn-outline-secondary btn-sm" href="?q={{ query|urlencode }}&amp;path={{ prefix|urlencode }}&amp;page={{ page|add:'-1' }}">Previous</a>{% endif %} <span>Page {{ page }}</span> {% if has_next %}<a class="btn btn-outline-secondary btn-sm" href="?q={{ query|urlencode }}&amp;path={{ prefix|urlencode }}&amp;page={{ page|add:'1' }}">Next</a>{% endif %}</nav>{% endif %}
</section>
</div>
{% endblock %}