pique/templates/documents/list_documents.html
Nicole Tietz-Sokolskaya 137dfa747d Improve editor user experience (no longer WYSIWYG, fixed bugs, added view vs. edit distinction) (#3)
This makes the editor experience much better (by subjective measures). Now instead of a WYSIWYG editor, we have a markdown code editor, and we also have the ability to view documents without editing them.

While I was at it, I fixed a bug where if you didn't edit a document at all, it would save blank. This was fixed as a happenstance from the switch.

Also included here is making the UI work with Javascript disabled. If you don't have JS, you will get a textarea which allows editing the markdown directly. If you do have JS enabled, you'll get a smarter editor.

Reviewed-on: #3
2024-06-03 14:56:15 +00:00

45 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html lang="en" class="h-full bg-white">
{% include "head.html" %}
<body class="h-full">
<div class="h-full">
{% set current_page = "documents" %}
{% include "components/sidebar.html" %}
<main class="pl-72 bg-gray-50 h-full">
<div class="navbar bg-accent text-accent-content">
<div class="navbar-start">
<a class="btn" href="/documents/new">New Document</a>
</div>
<div class="navbar-end">
<div class="btn">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z" />
</svg>
</div>
</div>
</div>
<div class="px-8 py-8 flex flex-col gap-y-4">
{% for document in documents %}
<div class="card w-96 bg-base-100 shadow-md border-2 border-solid">
<div class="card-body">
<h2 class="card-title">{{ document.title }}</h2>
<div class="card-actions justify-end">
<a href="/documents/view/{{ document.id }}" class="btn btn-primary">View</a>
<a href="/documents/edit/{{ document.id }}" class="btn btn-primary">Edit</a>
</div>
</div>
</div>
{% endfor %}
</div>
<div id="editor" class="prose bg-white"></div>
</main>
<script type="text/javascript" src="/static/main.js"></script>
</body>
</html>