Added partial support for tags

This commit is contained in:
2024-03-03 13:56:49 +01:00
parent 45036fe286
commit b74036343f
11 changed files with 283 additions and 81 deletions

View File

@ -0,0 +1,8 @@
{{define "page-content"}}
<h2>Neuer Benutzer</h2>
<form>
<input required name="tag" placeholder="Tag" type="text" />
<input type="submit" value="Anlegen" hx-post="/add-tag/" hx-target="#page-content" />
</form>
<button hx-get="/hub/" hx-target="#page-content">Abbrechen</button>
{{end}}

View File

@ -8,15 +8,16 @@
<input required name="first-name" placeholder="Vorname" type="text" value="{{.FirstName}}" />
<input required name="last-name" placeholder="Nachname" type="text" value="{{.LastName}}" />
<input required id="writer" name="role" type="radio" value="2" {{if eq .Role 2 }}checked{{end}} />
<label for="writer">Schreiber</label>
<input required id="writer" name="role" type="radio" value="2" {{if eq .Role "2" }}checked{{end}} />
<input required id="editor" name="role" type="radio" value="1" {{if eq .Role 1 }}checked{{end}} />
<label for="editor">Redakteur</label>
<input required id="editor" name="role" type="radio" value="1" {{if eq .Role "1" }}checked{{end}} />
<input required id="admin" name="role" type="radio" value="0" {{if eq .Role 0 }}checked{{end}} />
<label for="admin">Admin</label>
<input required id="admin" name="role" type="radio" value="0" {{if eq .Role "0" }}checked{{end}} />
<input type="submit" value="Anlegen" hx-post="/add-user/" hx-target="#page-content" />
</form>
<button hx-get="/hub/" hx-target="#page-content">Abbrechen</button>
<script>
var msg = "{{.Msg}}";

View File

@ -4,6 +4,10 @@
<input name="editor-title" placeholder="Titel" type="text" />
<textarea name="editor-desc" placeholder="Beschreibung"></textarea>
<textarea name="editor-text" placeholder="Artikel"></textarea>
{{range .}}
<input id="{{.}}" name="tags" type="checkbox" value="{{.}}" />
<label for="{{.}}">{{.}}</label>
{{end}}
<input type="submit" value="Senden" hx-post="/finish-article/" hx-target="#page-content" />
</form>
{{end}}

View File

@ -1,11 +1,12 @@
{{define "page-content"}}
<h2>Hub</h2>
<button hx-post="/write-article/" hx-target="#page-content">Artikel schreiben</button>
<button hx-post="/rss/" hx-target="#page-content">RSS Feed</button>
{{if eq . 0}}
<button hx-post="/create-user/" hx-target="#page-content">Benutzer hinzufügen</button>
{{end}}
<button hx-get="/write-article/" hx-target="#page-content">Artikel schreiben</button>
<button hx-get="/rss/" hx-target="#page-content">RSS Feed</button>
{{if lt . 2}}
<button hx-post="/unpublished-articles/" hx-target="#page-content">Unveröffentlichte Artikel</button>
<button hx-get="/unpublished-articles/" hx-target="#page-content">Unveröffentlichte Artikel</button>
<button hx-get="/create-tag/" hx-target="#page-content">Neuer Tag</button>
{{end}}
{{if eq . 0}}
<button hx-get="/create-user/" hx-target="#page-content">Benutzer hinzufügen</button>
{{end}}
{{end}}