FossilRepo

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

Keyboard Shortcuts

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