Implemented article preview
This commit is contained in:
@ -2,28 +2,26 @@
|
||||
<h2>Editor</h2>
|
||||
|
||||
<form id="edit-area">
|
||||
<div class="btn-area">
|
||||
<button class="btn" disabled hx-get="/hub" hx-target="#edit-area">Schreiben</button>
|
||||
<button class="btn" hx-post="/preview-article" hx-target="#edit-area">Vorschau</button>
|
||||
</div>
|
||||
{{if eq .Mode 0}}
|
||||
<button class="btn" hx-post="/preview-article" hx-target="#page-content">Vorschau</button>
|
||||
|
||||
<div class="flex flex-col gap-y-1">
|
||||
<label for="article-title">Titel</label>
|
||||
<input name="article-title" type="text" />
|
||||
<input name="article-title" type="text" value="{{.Title}}" />
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="article-description">Beschreibung</label>
|
||||
<textarea name="article-description"></textarea>
|
||||
<textarea name="article-description">{{.Description}}</textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="article-content">Artikel</label>
|
||||
<textarea name="article-content"></textarea>
|
||||
<textarea name="article-content">{{.Content}}</textarea>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span>Tags</span>
|
||||
<div class="flex flex-wrap gap-x-4">
|
||||
{{range .}}
|
||||
{{range .Tags}}
|
||||
<div>
|
||||
<input id="{{.Name}}" name="tags" type="checkbox" value="{{.ID}}" />
|
||||
<label for="{{.Name}}">{{.Name}}</label>
|
||||
@ -41,6 +39,26 @@
|
||||
<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>
|
||||
</div>
|
||||
{{else}}
|
||||
<button class="btn" hx-get="/write-article" hx-target="#page-content">Schreiben</button>
|
||||
|
||||
<span>Titel</span>
|
||||
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||
{{.Title}}
|
||||
</div>
|
||||
|
||||
<span>Beschreibung</span>
|
||||
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||
{{.Description}}
|
||||
</div>
|
||||
|
||||
<span>Artikel</span>
|
||||
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||
<div class="prose">
|
||||
{{.HTMLContent}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</form>
|
||||
|
||||
<script>
|
||||
@ -72,23 +90,3 @@
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
|
||||
{{define "preview"}}
|
||||
<span>Titel</span>
|
||||
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||
{{.Title}}
|
||||
</div>
|
||||
|
||||
<span>Beschreibung</span>
|
||||
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||
{{.Description}}
|
||||
</div>
|
||||
|
||||
<span>Artikel</span>
|
||||
<div class="bg-white border mb-3 px-2 py-2 rounded-md w-full">
|
||||
<div class="prose">
|
||||
{{.Content}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
Reference in New Issue
Block a user