intent/templates/features/history.html
Alec Perkins b9378b8397 Add projects and features with revision history (Phase 2)
Projects under organizations with fixed URL name and feature ID
prefix, three visibility levels, open contribution, per-project
roles, settings and typed-confirmation delete. Hidden projects 404.
Leaving an org drops its project roles. Project access rules live in
intent/access.py alongside org access.

Features numbered per project (INT-12) in a tree. Every change is a
revision with a required note; history, old revisions, and
side-by-side field and line diffs between any two. Cycles and
superseded-without-replacement are rejected. Markdown renders safely
with source-line attributes for Phase 3 line comments and headings
shifted below the page h1. Server-side preview works without JS.

Structural accessibility check runs on every page in tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 07:58:16 -04:00

59 lines
2.8 KiB
HTML

{% extends "projects/base.html" %}
{% block page_title %}History of {{ feature.key }}{% endblock %}
{% block project_content %}
<p><a href="{% url 'features:detail' org_slug=project.org.slug project_slug=project.slug feature_key=feature.key %}">Back to {{ feature.key }}</a></p>
<h1>History of <span class="muted">{{ feature.key }}</span> {{ feature.title }}</h1>
<form method="get" action="{% url 'features:compare' org_slug=project.org.slug project_slug=project.slug feature_key=feature.key %}">
<table>
<caption>{{ rows|length }} revision{{ rows|length|pluralize }}, newest first</caption>
<thead>
<tr>
<th scope="col">Revision</th>
<th scope="col">Date</th>
<th scope="col">Author</th>
<th scope="col">Note</th>
<th scope="col">Changed</th>
{% if rows|length > 1 %}
<th scope="col">From</th>
<th scope="col">To</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for row in rows %}
{% with rev=row.revision %}
<tr>
<th scope="row">
{% if rev.revision == feature.current_revision %}
<a href="{% url 'features:detail' org_slug=project.org.slug project_slug=project.slug feature_key=feature.key %}">{{ rev.revision }}</a> (current)
{% else %}
<a href="{% url 'features:revision' org_slug=project.org.slug project_slug=project.slug feature_key=feature.key revision=rev.revision %}">{{ rev.revision }}</a>
{% endif %}
</th>
<td><time datetime="{{ rev.created_at|date:'c' }}">{{ rev.created_at|date:"j M Y, H:i" }}</time></td>
<td>{{ rev.author.username|default:"unknown" }}</td>
<td>{{ rev.note }}</td>
<td>{{ row.changes|join:", " }}</td>
{% if rows|length > 1 %}
<td>
<input type="radio" name="old" value="{{ rev.revision }}" id="old-{{ rev.revision }}"{% if rev.revision == feature.current_revision|add:-1 %} checked{% endif %}>
<label for="old-{{ rev.revision }}" class="visually-hidden">Compare from revision {{ rev.revision }}</label>
</td>
<td>
<input type="radio" name="new" value="{{ rev.revision }}" id="new-{{ rev.revision }}"{% if rev.revision == feature.current_revision %} checked{% endif %}>
<label for="new-{{ rev.revision }}" class="visually-hidden">Compare to revision {{ rev.revision }}</label>
</td>
{% endif %}
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
{% if rows|length > 1 %}
<p><button type="submit">Compare selected revisions</button></p>
{% endif %}
</form>
{% endblock %}