|
1
|
{% extends "base.html" %} |
|
2
|
|
|
3
|
{% block title %}{{ form_title }} — {{ project.name }} — Fossilrepo{% endblock %} |
|
4
|
|
|
5
|
{% block extra_head %} |
|
6
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> |
|
7
|
{% endblock %} |
|
8
|
|
|
9
|
{% block content %} |
|
10
|
<h1 class="text-2xl font-bold text-gray-100 mb-2">{{ project.name }}</h1> |
|
11
|
{% include "fossil/_project_nav.html" %} |
|
12
|
|
|
13
|
<div class="mb-4"> |
|
14
|
<a href="{% url 'fossil:releases' slug=project.slug %}" class="text-sm text-brand-light hover:text-brand">← Back to Releases</a> |
|
15
|
</div> |
|
16
|
|
|
17
|
<div class="mx-auto max-w-3xl" x-data="{ tab: 'write' }"> |
|
18
|
<div class="flex items-center justify-between mb-4"> |
|
19
|
<h2 class="text-xl font-bold text-gray-100">{{ form_title }}</h2> |
|
20
|
<div class="flex items-center gap-1 text-xs"> |
|
21
|
<button @click="tab = 'write'" :class="tab === 'write' ? 'bg-brand text-white' : 'text-gray-500 hover:text-white'" class="px-3 py-1 rounded">Write</button> |
|
22
|
<button @click="tab = 'preview'; document.getElementById('preview-pane').innerHTML = DOMPurify.sanitize(marked.parse(document.getElementById('body-input').value))" :class="tab === 'preview' ? 'bg-brand text-white' : 'text-gray-500 hover:text-white'" class="px-3 py-1 rounded">Preview</button> |
|
23
|
</div> |
|
24
|
</div> |
|
25
|
|
|
26
|
<form method="post" class="space-y-4 rounded-lg bg-gray-800 p-6 shadow border border-gray-700"> |
|
27
|
{% csrf_token %} |
|
28
|
|
|
29
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4"> |
|
30
|
<div> |
|
31
|
<label class="block text-sm font-medium text-gray-300 mb-1">Tag Name <span class="text-red-400">*</span></label> |
|
32
|
<input type="text" name="tag_name" required placeholder="v1.0.0" |
|
33
|
value="{% if release %}{{ release.tag_name }}{% endif %}" |
|
34
|
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm font-mono" /> |
|
35
|
</div> |
|
36
|
<div> |
|
37
|
<label class="block text-sm font-medium text-gray-300 mb-1">Release Name <span class="text-red-400">*</span></label> |
|
38
|
<input type="text" name="name" required placeholder="Version 1.0.0 -- Initial Release" |
|
39
|
value="{% if release %}{{ release.name }}{% endif %}" |
|
40
|
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm" /> |
|
41
|
</div> |
|
42
|
</div> |
|
43
|
|
|
44
|
{% if recent_checkins %} |
|
45
|
<div> |
|
46
|
<label class="block text-sm font-medium text-gray-300 mb-1">Target Checkin (optional)</label> |
|
47
|
<select name="checkin_uuid" |
|
48
|
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
|
49
|
<option value="">-- None --</option> |
|
50
|
{% for ci in recent_checkins %} |
|
51
|
<option value="{{ ci.uuid }}" |
|
52
|
{% if release and release.checkin_uuid == ci.uuid %}selected{% endif %}> |
|
53
|
{{ ci.uuid|truncatechars:12 }} -- {{ ci.comment|truncatechars:60 }} |
|
54
|
</option> |
|
55
|
{% endfor %} |
|
56
|
</select> |
|
57
|
</div> |
|
58
|
{% endif %} |
|
59
|
|
|
60
|
<div x-show="tab === 'write'"> |
|
61
|
<label class="block text-sm font-medium text-gray-300 mb-1">Changelog (Markdown)</label> |
|
62
|
<textarea id="body-input" name="body" rows="14" placeholder="## What's new - Feature A - Bug fix B" |
|
63
|
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm font-mono">{% if release %}{{ release.body }}{% endif %}</textarea> |
|
64
|
</div> |
|
65
|
|
|
66
|
<div x-show="tab === 'preview'" style="display:none"> |
|
67
|
<div id="preview-pane" class="prose prose-invert prose-gray max-w-none min-h-[14rem] p-4 rounded-md border border-gray-700 bg-gray-900"> |
|
68
|
<p class="text-gray-500 italic">Click Preview to render...</p> |
|
69
|
</div> |
|
70
|
</div> |
|
71
|
|
|
72
|
<div class="flex items-center gap-6"> |
|
73
|
<label class="flex items-center gap-2 text-sm text-gray-300 cursor-pointer"> |
|
74
|
<input type="checkbox" name="is_prerelease" |
|
75
|
{% if release and release.is_prerelease %}checked{% endif %} |
|
76
|
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand" /> |
|
77
|
Pre-release |
|
78
|
</label> |
|
79
|
<label class="flex items-center gap-2 text-sm text-gray-300 cursor-pointer"> |
|
80
|
<input type="checkbox" name="is_draft" |
|
81
|
{% if release and release.is_draft %}checked{% endif %} |
|
82
|
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand" /> |
|
83
|
Draft |
|
84
|
</label> |
|
85
|
</div> |
|
86
|
|
|
87
|
<div class="flex justify-end gap-3 pt-2"> |
|
88
|
<a href="{% url 'fossil:releases' slug=project.slug %}" |
|
89
|
class="rounded-md bg-gray-700 px-4 py-2 text-sm font-semibold text-gray-100 shadow-sm ring-1 ring-inset ring-gray-600 hover:bg-gray-600"> |
|
90
|
Cancel |
|
91
|
</a> |
|
92
|
<button type="submit" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover"> |
|
93
|
{{ submit_label }} |
|
94
|
</button> |
|
95
|
</div> |
|
96
|
</form> |
|
97
|
</div> |
|
98
|
{% endblock %} |
|
99
|
|