FossilRepo

fossilrepo / templates / fossil / forum_form.html
1
{% extends "base.html" %}
2
{% block title %}{{ form_title }} — {{ project.name }} — Fossilrepo{% endblock %}
3
4
{% block extra_head %}
5
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
6
{% endblock %}
7
8
{% block content %}
9
<h1 class="text-2xl font-bold text-gray-100 mb-2">{{ project.name }}</h1>
10
{% include "fossil/_project_nav.html" %}
11
12
<div class="mb-4">
13
<a href="{% url 'fossil:forum' slug=project.slug %}" class="text-sm text-brand-light hover:text-brand">&larr; Back to Forum</a>
14
</div>
15
16
<div class="mx-auto max-w-3xl" x-data="{ tab: 'write' }">
17
<div class="flex items-center justify-between mb-4">
18
<h2 class="text-xl font-bold text-gray-100">{{ form_title }}</h2>
19
<div class="flex items-center gap-1 text-xs">
20
<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>
21
<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>
22
</div>
23
</div>
24
25
<form method="post" class="space-y-4 rounded-lg bg-gray-800 p-6 shadow-sm border border-gray-700">
26
{% csrf_token %}
27
28
{% if not parent %}
29
<div>
30
<label class="block text-sm font-medium text-gray-300 mb-1">Title <span class="text-red-400">*</span></label>
31
<input type="text" name="title" required placeholder="Thread title"
32
class="w-full rounded-md border-gray-600 bg-gray-900 text-gray-100 shadow-inner focus:border-brand focus:ring-1 focus:ring-brand sm:text-sm transition-colors">
33
</div>
34
{% endif %}
35
36
<div x-show="tab === 'write'">
37
<label class="block text-sm font-medium text-gray-300 mb-1">Body (Markdown) <span class="text-red-400">*</span></label>
38
<textarea id="body-input" name="body" rows="12" required placeholder="Write your post in Markdown..."
39
class="w-full rounded-md border-gray-600 bg-gray-800 text-gray-100 shadow-inner focus:border-brand focus:ring-1 focus:ring-brand sm:text-sm font-mono transition-colors"></textarea>
40
</div>
41
42
<div x-show="tab === 'preview'" style="display:none">
43
<div id="preview-pane" class="prose prose-invert prose-gray max-w-none min-h-[12rem] p-4 rounded-md border border-gray-700 bg-gray-900">
44
<p class="text-gray-500 italic">Click Preview to render...</p>
45
</div>
46
</div>
47
48
<div class="flex justify-end gap-3 pt-2">
49
<a href="{% url 'fossil:forum' slug=project.slug %}"
50
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 transition-colors">
51
Cancel
52
</a>
53
<button type="submit" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2 focus:ring-offset-gray-950 transition-colors">
54
{% if parent %}Post Reply{% else %}Create Thread{% endif %}
55
</button>
56
</div>
57
</form>
58
</div>
59
{% endblock %}
60

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button