Land CSOC-WP-0006 PageOps: member space/page CRUD, copy, transfer
Thin CONTENT_ROOT content plane (ADR-0003/0004) with space visual field, product UI for Title/Abstract/Visual, page list sidebar, and tests. Update capability model and smoke checklist; mark WP-0006 finished.
This commit is contained in:
parent
00dbb86c93
commit
affed64839
24 changed files with 1812 additions and 151 deletions
|
|
@ -1,11 +1,16 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}Spaces — {{ site_name }}{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Spaces</h1>
|
||||
<p class="muted">
|
||||
Co-creation spaces for your tenant.
|
||||
Page content will live as markdown in Forgejo-backed repositories.
|
||||
</p>
|
||||
<div style="display:flex;flex-wrap:wrap;justify-content:space-between;gap:1rem;align-items:flex-start;">
|
||||
<div>
|
||||
<h1 style="margin-bottom:0.35rem;">Spaces</h1>
|
||||
<p class="muted" style="margin:0;">
|
||||
Co-creation spaces for your tenant. Pages live as markdown on the content plane
|
||||
(local dir+git; Forgejo optional).
|
||||
</p>
|
||||
</div>
|
||||
<a class="btn" href="{% url 'spaces:create' %}">New space</a>
|
||||
</div>
|
||||
|
||||
{% if spaces %}
|
||||
<ul class="space-list" style="list-style:none;padding:0;margin:1.5rem 0 0;">
|
||||
|
|
@ -18,15 +23,20 @@
|
|||
{% if space.description %}
|
||||
<p class="muted" style="margin:0.35rem 0 0;font-size:0.95rem;">{{ space.description }}</p>
|
||||
{% endif %}
|
||||
{% if space.visual %}
|
||||
<p class="muted" style="margin:0.25rem 0 0;font-size:0.85rem;">Visual: {{ space.visual }}</p>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="card">
|
||||
<h2 style="margin-top:0;">No spaces yet</h2>
|
||||
<p class="muted" style="margin-bottom:0;">
|
||||
Operators can seed a space via Django admin (tenant-matched).
|
||||
Create-space UI and Forgejo binding land next (T04–T06).
|
||||
<p class="muted">
|
||||
Create a space to start writing pages (Title, Abstract, Visual + markdown body).
|
||||
</p>
|
||||
<p style="margin-bottom:0;">
|
||||
<a class="btn" href="{% url 'spaces:create' %}">Create your first space</a>
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -36,56 +36,136 @@
|
|||
align-items: center;
|
||||
}
|
||||
.content-actions form { display: inline; margin: 0; }
|
||||
.space-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
@media (min-width: 720px) {
|
||||
.space-layout {
|
||||
grid-template-columns: 12rem 1fr;
|
||||
align-items: start;
|
||||
}
|
||||
}
|
||||
.page-nav {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0.5rem 0 0;
|
||||
}
|
||||
.page-nav li { margin: 0.25rem 0; }
|
||||
.page-nav a {
|
||||
color: var(--color-muted);
|
||||
text-decoration: none;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.page-nav a:hover,
|
||||
.page-nav a.active { color: var(--color-text); font-weight: 600; }
|
||||
.visual-thumb {
|
||||
max-width: 100%;
|
||||
max-height: 8rem;
|
||||
border-radius: 6px;
|
||||
margin: 0.5rem 0 0;
|
||||
object-fit: cover;
|
||||
}
|
||||
.space-header-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
</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>
|
||||
<div class="space-header-row">
|
||||
<div>
|
||||
<h1 style="margin-bottom:0.25rem;">{{ space.title }}</h1>
|
||||
{% if space.description %}
|
||||
<p class="muted" style="margin:0;">{{ space.description }}</p>
|
||||
{% endif %}
|
||||
{% if forgejo_blob_url %}
|
||||
<a class="btn secondary small" href="{{ forgejo_blob_url }}" target="_blank" rel="noopener">View source</a>
|
||||
{% if space.visual %}
|
||||
<p class="content-meta muted" style="margin:0.35rem 0 0;">Visual: {{ space.visual }}</p>
|
||||
{% 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 %}
|
||||
<div class="content-actions" style="margin:0;">
|
||||
<a class="btn secondary small" href="{% url 'spaces:edit' space.slug %}">Edit space</a>
|
||||
<a class="btn secondary small" href="{% url 'spaces:page_new' space.slug %}">New page</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% 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 %}
|
||||
<div class="content-actions">
|
||||
<a class="btn small" href="{% url 'spaces:page_edit' space.slug page.slug|default:'index' %}">Edit page</a>
|
||||
{% if page.slug and page.slug != 'index' %}
|
||||
<a class="btn secondary small" href="{% url 'spaces:page_copy' space.slug page.slug %}">Copy</a>
|
||||
<a class="btn secondary small" href="{% url 'spaces:page_transfer' space.slug page.slug %}">Transfer</a>
|
||||
<form method="post" action="{% url 'spaces:page_delete' space.slug page.slug %}"
|
||||
onsubmit="return confirm('Delete this page?');">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn secondary small">Delete</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<a class="btn secondary small" href="{% url 'spaces:page_copy' space.slug 'index' %}">Copy index</a>
|
||||
{% endif %}
|
||||
{% if forgejo_edit_url %}
|
||||
<a class="btn secondary 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>
|
||||
|
||||
<div class="space-layout" style="margin-top:1.25rem;">
|
||||
<aside class="card" style="margin-top:0;">
|
||||
<strong style="font-size:0.9rem;">Pages</strong>
|
||||
<ul class="page-nav">
|
||||
{% for p in pages %}
|
||||
<li>
|
||||
<a href="{% url 'spaces:detail' space.slug %}{% if p.slug != 'index' %}?page={{ p.slug }}{% endif %}"
|
||||
class="{% if p.slug == page.slug %}active{% endif %}">
|
||||
{{ p.title|default:p.slug }}
|
||||
</a>
|
||||
</li>
|
||||
{% empty %}
|
||||
<li class="muted" style="font-size:0.9rem;">No local pages yet</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</aside>
|
||||
|
||||
<div>
|
||||
{% if page.error %}
|
||||
<div class="card content-error" style="margin-top:0;">
|
||||
<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>
|
||||
{% else %}
|
||||
<p class="content-meta muted">
|
||||
Create or edit a page to write markdown on the content plane.
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card md-body" style="margin-top:0;">
|
||||
{{ page.html|safe }}
|
||||
</div>
|
||||
<p class="content-meta muted">
|
||||
Binding: {{ space.forgejo_owner }}/{{ space.forgejo_repo }}
|
||||
· {{ page.path }} @ {{ space.default_branch }}
|
||||
Source: {{ page.source }} · {{ page.path }}
|
||||
{% if space.has_content_binding %}
|
||||
· {{ space.forgejo_owner }}/{{ space.forgejo_repo }}@{{ space.default_branch }}
|
||||
{% endif %}
|
||||
</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 %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
|||
74
coulomb_social/templates/spaces/form.html
Normal file
74
coulomb_social/templates/spaces/form.html
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}{{ form_title }} — {{ site_name }}{% endblock %}
|
||||
{% block extra_head %}
|
||||
<style>
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 0.5rem 0.75rem;
|
||||
margin-top: 0.25rem;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
font: inherit;
|
||||
min-height: 5rem;
|
||||
}
|
||||
.form-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
margin-top: 1.25rem;
|
||||
align-items: center;
|
||||
}
|
||||
.danger-zone {
|
||||
margin-top: 2rem;
|
||||
padding-top: 1.25rem;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<p class="muted" style="margin:0 0 0.5rem;">
|
||||
<a href="{% if space %}{% url 'spaces:detail' space.slug %}{% else %}{% url 'core:app_home' %}{% endif %}">← Back</a>
|
||||
</p>
|
||||
<h1>{{ form_title }}</h1>
|
||||
<p class="muted">Title and Abstract describe the space; Visual is a cover path under the space tree (e.g. <code>assets/cover.jpg</code>).</p>
|
||||
|
||||
<form method="post" class="card" style="margin-top:1rem;">
|
||||
{% csrf_token %}
|
||||
<label for="id_title">Title</label>
|
||||
<input type="text" id="id_title" name="title" required maxlength="255"
|
||||
value="{% if space %}{{ space.title }}{% endif %}" autocomplete="off">
|
||||
|
||||
<label for="id_slug">Slug {% if space %}<span class="muted">(fixed)</span>{% else %}<span class="muted">(optional — from title)</span>{% endif %}</label>
|
||||
<input type="text" id="id_slug" name="slug" maxlength="80"
|
||||
value="{% if space %}{{ space.slug }}{% endif %}"
|
||||
{% if space %}readonly{% endif %}
|
||||
pattern="[a-z0-9]+(?:-[a-z0-9]+)*"
|
||||
placeholder="my-space" autocomplete="off">
|
||||
|
||||
<label for="id_abstractor">Abstract</label>
|
||||
<textarea id="id_abstractor" name="abstractor" rows="3"
|
||||
placeholder="Short description of this space">{% if space %}{{ space.description }}{% endif %}</textarea>
|
||||
|
||||
<label for="id_visual">Visual</label>
|
||||
<input type="text" id="id_visual" name="visual" maxlength="512"
|
||||
value="{% if space %}{{ space.visual }}{% endif %}"
|
||||
placeholder="assets/cover.jpg" autocomplete="off">
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn">{{ submit_label }}</button>
|
||||
<a class="btn secondary" href="{% if space %}{% url 'spaces:detail' space.slug %}{% else %}{% url 'core:app_home' %}{% endif %}">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if space %}
|
||||
<div class="danger-zone">
|
||||
<h2 style="margin-top:0;font-size:1.1rem;">Archive space</h2>
|
||||
<p class="muted">Hides the space from the list. Content tree is soft-archived on disk.</p>
|
||||
<form method="post" action="{% url 'spaces:archive' space.slug %}"
|
||||
onsubmit="return confirm('Archive this space?');">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn secondary small">Archive space</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
55
coulomb_social/templates/spaces/page_copy.html
Normal file
55
coulomb_social/templates/spaces/page_copy.html
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}Copy page — {{ space.title }} — {{ site_name }}{% endblock %}
|
||||
{% block extra_head %}
|
||||
<style>
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 0.5rem 0.75rem;
|
||||
margin-top: 0.25rem;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
font: inherit;
|
||||
background: #fff;
|
||||
}
|
||||
.form-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
margin-top: 1.25rem;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<p class="muted" style="margin:0 0 0.5rem;">
|
||||
<a href="{% url 'spaces:detail' space.slug %}?page={{ page_slug }}">← {{ space.title }}</a>
|
||||
</p>
|
||||
<h1>Copy page</h1>
|
||||
<p class="muted">
|
||||
Create an independent copy of <strong>{{ page_slug }}</strong>.
|
||||
Relative visual assets are duplicated when present.
|
||||
</p>
|
||||
|
||||
<form method="post" class="card" style="margin-top:1rem;">
|
||||
{% csrf_token %}
|
||||
<label for="id_dest_space">Destination space</label>
|
||||
<select id="id_dest_space" name="dest_space">
|
||||
{% for s in all_spaces %}
|
||||
<option value="{{ s.slug }}" {% if s.slug == space.slug %}selected{% endif %}>{{ s.title }} ({{ s.slug }})</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<label for="id_dest_slug">New page slug</label>
|
||||
<input type="text" id="id_dest_slug" name="dest_slug" required maxlength="80"
|
||||
value="{{ default_dest }}"
|
||||
pattern="[a-z0-9]+(?:-[a-z0-9]+)*" autocomplete="off">
|
||||
|
||||
<label for="id_title">Title <span class="muted">(optional — defaults to “Original (copy)”)</span></label>
|
||||
<input type="text" id="id_title" name="title" maxlength="255" value="" autocomplete="off">
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn">Create copy</button>
|
||||
<a class="btn secondary" href="{% url 'spaces:detail' space.slug %}?page={{ page_slug }}">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
70
coulomb_social/templates/spaces/page_form.html
Normal file
70
coulomb_social/templates/spaces/page_form.html
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}{{ form_title }} — {{ space.title }} — {{ site_name }}{% endblock %}
|
||||
{% block extra_head %}
|
||||
<style>
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 0.5rem 0.75rem;
|
||||
margin-top: 0.25rem;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
font: inherit;
|
||||
}
|
||||
textarea.body-editor {
|
||||
min-height: 16rem;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.form-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
margin-top: 1.25rem;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<p class="muted" style="margin:0 0 0.5rem;">
|
||||
<a href="{% url 'spaces:detail' space.slug %}{% if doc.slug and doc.slug != 'index' and not is_new %}?page={{ doc.slug }}{% endif %}">← {{ space.title }}</a>
|
||||
</p>
|
||||
<h1>{{ form_title }}</h1>
|
||||
<p class="muted">Markdown body is the source of truth. Title, Abstract, and Visual are stored in frontmatter.</p>
|
||||
|
||||
<form method="post" class="card" style="margin-top:1rem;">
|
||||
{% csrf_token %}
|
||||
<label for="id_title">Title</label>
|
||||
<input type="text" id="id_title" name="title" maxlength="255"
|
||||
value="{{ doc.title }}" autocomplete="off"
|
||||
placeholder="Page title">
|
||||
|
||||
<label for="id_slug">Slug {% if doc.slug == 'index' %}<span class="muted">(space index — fixed)</span>{% endif %}</label>
|
||||
{% if doc.slug == 'index' %}
|
||||
<input type="text" id="id_slug" name="slug" value="index" readonly maxlength="80">
|
||||
{% else %}
|
||||
<input type="text" id="id_slug" name="slug" maxlength="80"
|
||||
value="{{ doc.slug }}"
|
||||
pattern="[a-z0-9]+(?:-[a-z0-9]+)*"
|
||||
placeholder="page-slug" autocomplete="off"
|
||||
{% if is_new %}required{% endif %}>
|
||||
{% endif %}
|
||||
|
||||
<label for="id_abstractor">Abstract</label>
|
||||
<textarea id="id_abstractor" name="abstractor" rows="2"
|
||||
placeholder="Short abstract">{{ doc.abstractor }}</textarea>
|
||||
|
||||
<label for="id_visual">Visual</label>
|
||||
<input type="text" id="id_visual" name="visual" maxlength="512"
|
||||
value="{{ doc.visual }}"
|
||||
placeholder="assets/page-cover.jpg" autocomplete="off">
|
||||
|
||||
<label for="id_body">Body (markdown)</label>
|
||||
<textarea id="id_body" name="body" class="body-editor" rows="18">{{ doc.body }}</textarea>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn">{% if is_new %}Create page{% else %}Save page{% endif %}</button>
|
||||
<a class="btn secondary" href="{% url 'spaces:detail' space.slug %}">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
59
coulomb_social/templates/spaces/page_transfer.html
Normal file
59
coulomb_social/templates/spaces/page_transfer.html
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}Transfer page — {{ space.title }} — {{ site_name }}{% endblock %}
|
||||
{% block extra_head %}
|
||||
<style>
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 0.5rem 0.75rem;
|
||||
margin-top: 0.25rem;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
font: inherit;
|
||||
background: #fff;
|
||||
}
|
||||
.form-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
margin-top: 1.25rem;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<p class="muted" style="margin:0 0 0.5rem;">
|
||||
<a href="{% url 'spaces:detail' space.slug %}?page={{ page_slug }}">← {{ space.title }}</a>
|
||||
</p>
|
||||
<h1>Transfer page</h1>
|
||||
<p class="muted">
|
||||
Move <strong>{{ page_slug }}</strong> out of this space into another space you can access.
|
||||
The source page is removed after a successful move. The space index cannot be transferred.
|
||||
</p>
|
||||
|
||||
{% if not all_spaces %}
|
||||
<div class="card">
|
||||
<p style="margin:0;">No other spaces available. Create another space first, then transfer.</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<form method="post" class="card" style="margin-top:1rem;">
|
||||
{% csrf_token %}
|
||||
<label for="id_dest_space">Destination space</label>
|
||||
<select id="id_dest_space" name="dest_space" required>
|
||||
<option value="">— choose —</option>
|
||||
{% for s in all_spaces %}
|
||||
<option value="{{ s.slug }}">{{ s.title }} ({{ s.slug }})</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<label for="id_dest_slug">Slug in destination <span class="muted">(optional)</span></label>
|
||||
<input type="text" id="id_dest_slug" name="dest_slug" maxlength="80"
|
||||
value="{{ page_slug }}"
|
||||
pattern="[a-z0-9]+(?:-[a-z0-9]+)*" autocomplete="off">
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn">Transfer page</button>
|
||||
<a class="btn secondary" href="{% url 'spaces:detail' space.slug %}?page={{ page_slug }}">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue