2024-02-18 10:07:49 +01:00
|
|
|
{{define "page-content"}}
|
2024-02-24 09:54:25 +01:00
|
|
|
<h2>Editor</h2>
|
2024-04-07 18:57:03 +02:00
|
|
|
|
2024-02-18 10:07:49 +01:00
|
|
|
<form>
|
2024-04-01 14:22:59 +02:00
|
|
|
<div class="flex flex-col gap-y-1">
|
|
|
|
<label for="article-title">Titel</label>
|
|
|
|
<input name="article-title" type="text" />
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-col">
|
|
|
|
<label for="article-description">Beschreibung</label>
|
|
|
|
<textarea name="article-description"></textarea>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-col">
|
|
|
|
<label for="article-content">Artikel</label>
|
|
|
|
<textarea name="article-content"></textarea>
|
2024-03-28 08:41:38 +01:00
|
|
|
</div>
|
|
|
|
|
2024-04-03 18:08:56 +02:00
|
|
|
<div>
|
|
|
|
<span>Tags</span>
|
2024-04-03 19:51:27 +02:00
|
|
|
<div class="flex flex-wrap gap-x-4">
|
2024-04-03 18:08:56 +02:00
|
|
|
{{range .}}
|
|
|
|
<div>
|
|
|
|
<input id="{{.Name}}" name="tags" type="checkbox" value="{{.ID}}" />
|
|
|
|
<label for="{{.Name}}">{{.Name}}</label>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2024-03-28 08:41:38 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2024-03-29 09:07:17 +01:00
|
|
|
<div id="editor-images">
|
2024-04-03 20:24:54 +02:00
|
|
|
<input class="mb-2" name="article-image" type="file" hx-encoding="multipart/form-data" hx-post="/upload-image"
|
2024-03-29 09:07:17 +01:00
|
|
|
hx-swap="beforeend" hx-target="#editor-images" />
|
|
|
|
</div>
|
|
|
|
|
2024-04-01 14:22:59 +02:00
|
|
|
<div class="btn-area">
|
2024-04-03 20:24:54 +02:00
|
|
|
<input class="action-btn" type="submit" value="Senden" hx-post="/submit-article" hx-target="#page-content" />
|
|
|
|
<button class="btn" hx-get="/hub" hx-target="#page-content">Abbrechen</button>
|
2024-04-01 14:22:59 +02:00
|
|
|
</div>
|
2024-02-18 10:07:49 +01:00
|
|
|
</form>
|
2024-03-28 08:41:38 +01:00
|
|
|
|
2024-03-29 09:07:17 +01:00
|
|
|
<script>
|
|
|
|
function copyToClipboard(text) {
|
|
|
|
event.preventDefault(); // Get-Request verhindern
|
|
|
|
|
|
|
|
var textarea = document.createElement("textarea");
|
|
|
|
textarea.textContent = text;
|
|
|
|
document.body.appendChild(textarea);
|
|
|
|
|
|
|
|
textarea.select();
|
|
|
|
try {
|
|
|
|
document.execCommand('copy');
|
|
|
|
} catch (err) {
|
|
|
|
console.warn('Fehler beim Kopieren', err);
|
|
|
|
}
|
|
|
|
|
|
|
|
document.body.removeChild(textarea);
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{define "editor-images"}}
|
|
|
|
{{if gt (len .) 0}}
|
2024-04-01 14:22:59 +02:00
|
|
|
<div class="border px-2 py-1 rounded-md flex gap-4 justify-between">
|
|
|
|
<div class="self-center">{{.}}</div>
|
|
|
|
<button class="bg-slate-50 border my-2 px-3 py-2 rounded-md w-32 hover:bg-slate-100"
|
|
|
|
onclick="copyToClipboard('{{.}}')">Kopieren</button>
|
2024-03-29 09:07:17 +01:00
|
|
|
</div>
|
|
|
|
{{end}}
|
2024-02-18 10:07:49 +01:00
|
|
|
{{end}}
|