mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-29 05:41:54 +02:00
fix: ingestion modal works on all pages
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
<div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-4" id="text_content_cards">
|
<div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-4" id="text_content_cards">
|
||||||
{% for text_content in text_contents %}
|
{% for text_content in text_contents %}
|
||||||
<div class="card min-w-72 bg-base-100 shadow">
|
<div class="card min-w-72 bg-base-100 shadow">
|
||||||
|
{% if text_content.url_info %}
|
||||||
<img class="rounded-t-md overflow-clip" src="/file/{{text_content.url_info.image_id}}" />
|
<img class="rounded-t-md overflow-clip" src="/file/{{text_content.url_info.image_id}}" />
|
||||||
|
{% endif %}
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="flex justify-between space-x-2">
|
<div class="flex justify-between space-x-2">
|
||||||
<h2 class="card-title truncate">
|
<h2 class="card-title truncate">
|
||||||
@@ -14,7 +16,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="flex-shrink-0">
|
<div class="flex-shrink-0">
|
||||||
{% if text_content.url %}
|
{% if text_content.url_info %}
|
||||||
{% include "icons/globe_icon.html" %}
|
{% include "icons/globe_icon.html" %}
|
||||||
{% elif text_content.file_info %}
|
{% elif text_content.file_info %}
|
||||||
{% include "icons/document_icon.html" %}
|
{% include "icons/document_icon.html" %}
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
{% extends "modal_base.html" %}
|
{% extends "modal_base.html" %}
|
||||||
|
|
||||||
{% block form_attributes %}
|
{% block form_attributes %}
|
||||||
hx-post="/ingress-form"
|
hx-post="/ingress-form"
|
||||||
enctype="multipart/form-data"
|
enctype="multipart/form-data"
|
||||||
hx-target="#active_jobs_section"
|
|
||||||
hx-swap="outerHTML"
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block modal_content %}
|
{% block modal_content %}
|
||||||
<h3 class="text-lg font-bold">Add new content</h3>
|
<h3 class="text-lg font-bold">Add new content</h3>
|
||||||
|
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label class="floating-label">
|
<label class="floating-label">
|
||||||
<span>Instructions</span>
|
<span>Instructions</span>
|
||||||
@@ -19,7 +14,6 @@ hx-swap="outerHTML"
|
|||||||
<div class="validator-hint hidden">Instructions are required</div>
|
<div class="validator-hint hidden">Instructions are required</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label class="floating-label">
|
<label class="floating-label">
|
||||||
<span>Content</span>
|
<span>Content</span>
|
||||||
@@ -27,7 +21,6 @@ hx-swap="outerHTML"
|
|||||||
placeholder="Enter the content you want to ingress, it can be an URL or a text snippet">{{ content }}</textarea>
|
placeholder="Enter the content you want to ingress, it can be an URL or a text snippet">{{ content }}</textarea>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label class="floating-label">
|
<label class="floating-label">
|
||||||
<span>Category</span>
|
<span>Category</span>
|
||||||
@@ -41,15 +34,26 @@ hx-swap="outerHTML"
|
|||||||
<div class="validator-hint hidden">Category is required</div>
|
<div class="validator-hint hidden">Category is required</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label class="label label-text">Files</label>
|
<label class="label label-text">Files</label>
|
||||||
<input type="file" name="files" multiple class="file-input file-input-bordered w-full" />
|
<input type="file" name="files" multiple class="file-input file-input-bordered w-full" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="error-message" class="text-error text-center {% if not error %}hidden{% endif %}">{{ error }}</div>
|
<div id="error-message" class="text-error text-center {% if not error %}hidden{% endif %}">{{ error }}</div>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
const form = document.getElementById('modal_form');
|
||||||
|
if (!form) return;
|
||||||
|
const targetElement = document.getElementById('active_jobs_section');
|
||||||
|
if (targetElement) {
|
||||||
|
form.setAttribute('hx-target', '#active_jobs_section');
|
||||||
|
form.setAttribute('hx-swap', 'outerHTML');
|
||||||
|
} else {
|
||||||
|
form.setAttribute('hx-swap', 'none');
|
||||||
|
form.removeAttribute('hx-target');
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block primary_actions %}
|
{% block primary_actions %}
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
Save Changes
|
Save Changes
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<li>
|
<li>
|
||||||
<button class="btn btn-primary" hx-get="/ingress-form" hx-target="#modal" hx-swap="innerHTML">Add
|
<button class="btn btn-primary btn-outline w-full flex items-center gap-3 justify-start mt-2"
|
||||||
|
hx-get="/ingress-form" hx-target="#modal" hx-swap="innerHTML">{% include "icons/send_icon.html" %} Add
|
||||||
Content</button>
|
Content</button>
|
||||||
</li>
|
</li>
|
||||||
<div class="divider "></div>
|
<div class="divider "></div>
|
||||||
@@ -78,7 +79,6 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><span class="text-xs italic text-base-content/60 px-4">No recent chats</span></li>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user