2024-02-18 10:07:49 +01:00
|
|
|
{{define "page-content"}}
|
2024-02-24 09:54:25 +01:00
|
|
|
<h2>Editor</h2>
|
2024-02-18 10:07:49 +01:00
|
|
|
<form>
|
2024-03-28 08:41:38 +01:00
|
|
|
<div>
|
|
|
|
<input name="article-title" placeholder="Titel" type="text" />
|
|
|
|
<textarea name="article-description" placeholder="Beschreibung"></textarea>
|
|
|
|
<textarea name="article-content" placeholder="Artikel"></textarea>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
{{range .}}
|
|
|
|
<div>
|
|
|
|
<input id="{{.Name}}" name="tags" type="checkbox" value="{{.ID}}" />
|
|
|
|
<label for="{{.Name}}">{{.Name}}</label>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
|
2024-03-29 09:07:17 +01:00
|
|
|
<div id="editor-images">
|
|
|
|
<input name="article-image" type="file" hx-encoding="multipart/form-data" hx-post="/upload-image/"
|
|
|
|
hx-swap="beforeend" hx-target="#editor-images" />
|
|
|
|
</div>
|
|
|
|
|
2024-03-10 15:03:46 +01:00
|
|
|
<input type="submit" value="Senden" hx-post="/submit-article/" hx-target="#page-content" />
|
2024-02-18 10:07:49 +01:00
|
|
|
</form>
|
2024-03-28 08:41:38 +01:00
|
|
|
|
|
|
|
<button hx-get="/hub/" hx-target="#page-content">Abbrechen</button>
|
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}}
|
|
|
|
<div>
|
|
|
|
{{.}}
|
|
|
|
<button onclick="copyToClipboard('{{.}}')">Kopieren</button>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2024-02-18 10:07:49 +01:00
|
|
|
{{end}}
|