coulomb-social/coulomb_social/templates/spaces/detail.html
tegwick 3f30bcd340 Add Forgejo edit/refresh sync path for space content (T05)
Keep git as source of truth: deep-link to Forgejo editor, manual refresh to
drop cache, and optional signed push webhook for automatic invalidation.
2026-08-12 03:29:26 +02:00

91 lines
3 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ page.title|default:space.title }} — {{ site_name }}{% endblock %}
{% block extra_head %}
<style>
.md-body h1 { font-size: 1.75rem; margin-top: 0; }
.md-body h2 { font-size: 1.25rem; margin-top: 1.5rem; }
.md-body pre {
background: #f5f5f5;
padding: 0.85rem 1rem;
border-radius: 6px;
overflow-x: auto;
}
.md-body code { font-family: ui-monospace, monospace; font-size: 0.9em; }
.md-body table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.md-body th, .md-body td {
border: 1px solid #e5e5e5;
padding: 0.4rem 0.65rem;
text-align: left;
}
.md-body blockquote {
margin: 1rem 0;
padding-left: 1rem;
border-left: 3px solid var(--color-primary);
color: var(--color-muted);
}
.content-meta { font-size: 0.85rem; margin-top: 0.75rem; }
.content-error {
border-color: #fcd34d;
background: #fffbeb;
}
.content-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 1rem 0 0;
align-items: center;
}
.content-actions form { display: inline; margin: 0; }
</style>
{% endblock %}
{% block content %}
<p class="muted" style="margin:0 0 0.5rem;">
<a href="{% url 'core:app_home' %}">← Spaces</a>
</p>
<h1>{{ space.title }}</h1>
{% if space.description %}
<p class="muted">{{ space.description }}</p>
{% endif %}
{% if space.has_content_binding %}
<div class="content-actions">
{% if forgejo_edit_url %}
<a class="btn small" href="{{ forgejo_edit_url }}" target="_blank" rel="noopener">Edit in Forgejo</a>
{% endif %}
{% if forgejo_blob_url %}
<a class="btn secondary small" href="{{ forgejo_blob_url }}" target="_blank" rel="noopener">View source</a>
{% endif %}
<form method="post" action="{% url 'spaces:refresh' space.slug %}">
{% csrf_token %}
<input type="hidden" name="page" value="{{ page.slug|default:'index' }}">
<button type="submit" class="btn secondary small">Refresh content</button>
</form>
</div>
<p class="muted content-meta" style="margin-top:0.5rem;">
Git is the source of truth. Edit in Forgejo, then refresh (or wait for webhook).
</p>
{% endif %}
{% if page.error %}
<div class="card content-error">
<h2 style="margin-top:0;">Content unavailable</h2>
<p style="margin-bottom:0;">{{ page.error }}</p>
{% if space.has_content_binding %}
<p class="content-meta muted">
Binding: {{ space.forgejo_owner }}/{{ space.forgejo_repo }}
· {{ page.path }} @ {{ space.default_branch }}
</p>
{% endif %}
</div>
{% else %}
<div class="card md-body">
{{ page.html|safe }}
</div>
<p class="content-meta muted">
Source: {{ page.source }} · {{ page.path }}
{% if space.has_content_binding %}
· {{ space.forgejo_owner }}/{{ space.forgejo_repo }}@{{ space.default_branch }}
{% endif %}
</p>
{% endif %}
{% endblock %}