FossilRepo

fossilrepo / templates / fossil / technote_form.html
Source Blame History 66 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:technotes' slug=project.slug %}" class="text-sm text-brand-light hover:text-brand">&larr; Back to Technotes</a>
c588255… ragelink 14 </div>
c588255… ragelink 15
c588255… ragelink 16 <div class="mx-auto max-w-6xl" 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('content-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
c588255… ragelink 25 <form method="post" class="space-y-4 rounded-lg bg-gray-800 p-6 shadow border border-gray-700">
c588255… ragelink 26 {% csrf_token %}
c588255… ragelink 27
c588255… ragelink 28 {% if not note %}
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="Technote title"
c588255… ragelink 32 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">
c588255… ragelink 33 </div>
c588255… ragelink 34
c588255… ragelink 35 <div>
c588255… ragelink 36 <label class="block text-sm font-medium text-gray-300 mb-1">Timestamp</label>
c588255… ragelink 37 <input type="datetime-local" name="timestamp"
c588255… ragelink 38 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">
c588255… ragelink 39 <p class="mt-1 text-xs text-gray-500">Leave blank to use current time.</p>
c588255… ragelink 40 </div>
c588255… ragelink 41 {% endif %}
c588255… ragelink 42
c588255… ragelink 43 <div x-show="tab === 'write'">
c588255… ragelink 44 <label class="block text-sm font-medium text-gray-300 mb-1">Body (Markdown)</label>
c588255… ragelink 45 <textarea id="content-input" name="body" rows="20" placeholder="Write in Markdown..."
c588255… ragelink 46 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 note %}{{ note.body }}{% endif %}</textarea>
c588255… ragelink 47 </div>
c588255… ragelink 48
c588255… ragelink 49 <div x-show="tab === 'preview'" style="display:none">
c588255… ragelink 50 <div id="preview-pane" class="prose prose-invert prose-gray max-w-none min-h-[20rem] p-4 rounded-md border border-gray-700 bg-gray-900">
c588255… ragelink 51 <p class="text-gray-500 italic">Click Preview to render...</p>
c588255… ragelink 52 </div>
c588255… ragelink 53 </div>
c588255… ragelink 54
c588255… ragelink 55 <div class="flex justify-end gap-3 pt-2">
c588255… ragelink 56 <a href="{% url 'fossil:technotes' slug=project.slug %}"
c588255… ragelink 57 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">
c588255… ragelink 58 Cancel
c588255… ragelink 59 </a>
c588255… ragelink 60 <button type="submit" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover">
c588255… ragelink 61 {% if note %}Update{% else %}Create Technote{% endif %}
c588255… ragelink 62 </button>
c588255… ragelink 63 </div>
c588255… ragelink 64 </form>
c588255… ragelink 65 </div>
c588255… ragelink 66 {% 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