fix: further fixes re content viewing and editing

This commit is contained in:
Per Stark
2025-04-30 14:16:46 +02:00
parent bcdd3628ef
commit 3f032c6930
4 changed files with 18 additions and 16 deletions

View File

@@ -5,8 +5,8 @@
<div class="card-body">
<div class="flex justify-between space-x-2">
<h2 class="card-title truncate">
{% if text_content.url %}
<a href="{{ text_content.url}}">{{text_content.url}}</a>
{% if text_content.url_info %}
<a href="{{ text_content.url_info.url}}">{{text_content.url_info.title}}</a>
{% elif text_content.file_info %}
{{text_content.file_info.file_name}}
{% else %}

View File

@@ -1,31 +1,35 @@
{% extends "modal_base.html" %}
{% block modal_class %}
flex flex-col min-h-[95%] w-11/12 max-w-[90ch] max-h-[95%]
{% endblock %}
{% block form_attributes %}
hx-patch="/content/{{text_content.id}}"
hx-target="#main_section"
hx-swap="outerHTML"
class="flex flex-col flex-1 h-full"
{% endblock %}
{% block modal_content %}
<h3 class="text-lg font-bold ">Edit Content</h3>
<h3 class="text-lg font-bold">Edit Content</h3>
<div class="form-control">
<label class="floating-label">
<span class="label-text">Instructions</span>
<input type="text" name="instructions" value="{{ text_content.instructions}}" class="w-full input input-bordered">
<input type="text" name="instructions" value="{{ text_content.instructions }}" class="w-full input input-bordered">
</label>
</div>
<div class="form-control ">
<label class="floating-label">
<span class="label-text">Category</span>
<input type="text" name="category" value="{{ text_content.category}}" class="w-full input input-bordered">
</label>
</div>
<div class="form-control">
<label class="floating-label">
<span class="label-text">Category</span>
<input type="text" name="category" value="{{ text_content.category }}" class="w-full input input-bordered">
</label>
</div>
<div class="form-control flex-1 flex flex-col min-h-0">
<label class="floating-label flex-1 flex flex-col min-h-0">
<span class="label-text">Text</span>
<textarea name="text" class="textarea textarea-bordered h-32 w-full">{{ text_content.text}}</textarea>
<textarea name="text" class="textarea textarea-bordered w-full flex-1 min-h-[200px] h-full resize-none">{{
text_content.text }}</textarea>
</label>
</div>
{% endblock %}

View File

@@ -18,12 +18,10 @@
breaks: true, gfm: true, headerIds: false, mangle: false,
smartLists: true, smartypants: true, xhtml: false
});
console.log('initialized');
}
function renderStaticMarkdown() {
document.querySelectorAll('.markdown-content').forEach(el => {
console.log('hello');
const raw = el.getAttribute('data-content') || '';
el.innerHTML = marked.parse(raw);
});

View File

@@ -1,7 +1,7 @@
<dialog id="body_modal" class="modal">
<div class="modal-box {% block modal_class %}{% endblock %} ">
<form id="modal_form" {% block form_attributes %}{% endblock %}>
<div class="flex flex-col space-y-4">
<div class="flex flex-col flex-1 space-y-4">
{% block modal_content %} <!-- Form fields go here in child templates -->
{% endblock %}
</div>