sklad: clean up templates
This commit is contained in:
parent
885d161cf5
commit
21d01f4c4b
|
@ -21,13 +21,12 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Container }}
|
{{ if .Container }}
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<header>
|
<header>
|
||||||
<h2>{{ .Container.Id }}
|
<h2>{{ .Container.Id }}
|
||||||
{{ range .Container.Path }}
|
{{- range .Container.Path }}
|
||||||
<small>« <a href="container?id={{ . }}">{{ . }}</a></small>
|
<small>« <a href="container?id={{ . }}">{{ . }}</a></small>
|
||||||
{{ end }}
|
{{- end }}
|
||||||
</h2>
|
</h2>
|
||||||
<form method=post action="label?id={{ .Container.Id }}" target=_blank>
|
<form method=post action="label?id={{ .Container.Id }}" target=_blank>
|
||||||
<input type=submit value="Vytisknout štítek">
|
<input type=submit value="Vytisknout štítek">
|
||||||
|
@ -35,50 +34,51 @@
|
||||||
<form method=post action="container?id={{ .Container.Id }}&remove">
|
<form method=post action="container?id={{ .Container.Id }}&remove">
|
||||||
<input type=submit value="Odstranit">
|
<input type=submit value="Odstranit">
|
||||||
</form>
|
</form>
|
||||||
</header>
|
</header>
|
||||||
|
<form method=post action="container?id={{ .Container.Id }}">
|
||||||
<form method=post action="container?id={{ .Container.Id }}">
|
<textarea name=description
|
||||||
<textarea name=description rows="{{ max 5 (lines .Container.Description) }}"
|
rows="{{ max 5 (lines .Container.Description) }}"
|
||||||
placeholder="Popis obalu nebo jeho obsahu">
|
placeholder="Popis obalu nebo jeho obsahu">
|
||||||
{{ .Container.Description }}</textarea>
|
{{- .Container.Description -}}
|
||||||
<footer>
|
</textarea>
|
||||||
|
<footer>
|
||||||
<div>
|
<div>
|
||||||
<label for=series>Řada:</label>
|
<label for=series>Řada:</label>
|
||||||
<select name=series id=series>
|
<select name=series id=series>
|
||||||
{{ range $prefix, $desc := .AllSeries }}
|
{{- range $prefix, $desc := .AllSeries }}
|
||||||
<option value="{{ $prefix }}"
|
<option value="{{ $prefix }}"
|
||||||
{{ if eq $prefix $.Container.Series }}selected{{ end }}
|
{{ if eq $prefix $.Container.Series }}selected{{ end -}}
|
||||||
>{{ $prefix }} — {{ $desc }}</option>
|
>{{ $prefix }} — {{ $desc }}</option>
|
||||||
{{ end }}
|
{{- end }}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for=parent>Nadobal:</label>
|
<label for=parent>Nadobal:</label>
|
||||||
<input type=text name=parent id=parent value="{{ .Container.Parent }}">
|
<input type=text name=parent id=parent
|
||||||
|
value="{{ .Container.Parent }}">
|
||||||
</div>
|
</div>
|
||||||
<input type=submit value="Uložit">
|
<input type=submit value="Uložit">
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<h2>Podobaly</h3>
|
<h2>Podobaly</h3>
|
||||||
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<section>
|
<section>
|
||||||
<header>
|
<header>
|
||||||
<h2>Nový obal</h2>
|
<h2>Nový obal</h2>
|
||||||
</header>
|
</header>
|
||||||
<form method=post action="container">
|
<form method=post action="container">
|
||||||
<textarea name=description rows=5
|
<textarea name=description rows=5
|
||||||
placeholder="Popis obalu nebo jeho obsahu"></textarea>
|
placeholder="Popis obalu nebo jeho obsahu"></textarea>
|
||||||
<footer>
|
<footer>
|
||||||
<div>
|
<div>
|
||||||
<label for=series>Řada:</label>
|
<label for=series>Řada:</label>
|
||||||
<select name=series id=series>
|
<select name=series id=series>
|
||||||
{{ range $prefix, $desc := .AllSeries }}
|
{{- range $prefix, $desc := .AllSeries }}
|
||||||
<option value="{{ $prefix }}"
|
<option value="{{ $prefix }}"
|
||||||
>{{ $prefix }} — {{ $desc }}</option>
|
>{{ $prefix }} — {{ $desc }}</option>
|
||||||
{{ end }}
|
{{- end }}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -86,8 +86,8 @@
|
||||||
<input type=text name=parent id=parent value="">
|
<input type=text name=parent id=parent value="">
|
||||||
</div>
|
</div>
|
||||||
<input type=submit value="Uložit">
|
<input type=submit value="Uložit">
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<h2>Obaly nejvyšší úrovně</h2>
|
<h2>Obaly nejvyšší úrovně</h2>
|
||||||
|
@ -95,28 +95,36 @@
|
||||||
|
|
||||||
{{ range .Children }}
|
{{ range .Children }}
|
||||||
<section>
|
<section>
|
||||||
<header>
|
<header>
|
||||||
<h3><a href="container?id={{ .Id }}">{{ .Id }}</a>
|
<h3><a href="container?id={{ .Id }}">{{ .Id }}</a>
|
||||||
{{ range .Path }}
|
{{- range .Path }}
|
||||||
<small>« <a href="container?id={{ . }}">{{ . }}</a></small>
|
<small>« <a href="container?id={{ . }}">{{ . }}</a></small>
|
||||||
{{ end }}
|
{{- end }}
|
||||||
</h3>
|
</h3>
|
||||||
<form method=post action="label?id={{ .Id }}" target=_blank>
|
<form method=post action="label?id={{ .Id }}" target=_blank>
|
||||||
|
{{- if $.Container }}
|
||||||
|
<input type=hidden name=context value="{{ $.Container.Id }}">
|
||||||
|
{{- end }}
|
||||||
<input type=submit value="Vytisknout štítek">
|
<input type=submit value="Vytisknout štítek">
|
||||||
</form>
|
</form>
|
||||||
<form method=post action="container?id={{ .Id }}&remove">
|
<form method=post action="container?id={{ .Id }}&remove">
|
||||||
|
{{- if $.Container }}
|
||||||
|
<input type=hidden name=context value="{{ $.Container.Id }}">
|
||||||
|
{{- end }}
|
||||||
<input type=submit value="Odstranit">
|
<input type=submit value="Odstranit">
|
||||||
</form>
|
</form>
|
||||||
</header>
|
</header>
|
||||||
{{ if .Description }}
|
|
||||||
<p>{{ .Description }}
|
{{- if .Description }}
|
||||||
{{ end }}
|
<p>{{ .Description }}
|
||||||
{{ if .Children }}
|
{{- end }}
|
||||||
<p>
|
|
||||||
{{ range .Children }}
|
{{- if .Children }}
|
||||||
<a href="container?id={{ .Id }}">{{ .Id }}</a>
|
<p>
|
||||||
{{ end }}
|
{{- range .Children }}
|
||||||
{{ end }}
|
<a href="container?id={{ .Id }}">{{ .Id }}</a>
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
</section>
|
</section>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>Obal je prázdný.
|
<p>Obal je prázdný.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{{ define "Title" }}Tisk štítku{{ end }}
|
{{ define "Title" }}Tisk štítku{{ end }}
|
||||||
{{ define "Content" }}
|
{{ define "Content" }}
|
||||||
|
|
||||||
<h2>Tisk štítku pro <a href="container?id={{ .Id }}">{{ .Id }}</a></h2>
|
<h2>Tisk štítku pro <a href="container?id={{ .Id }}">{{ .Id }}</a></h2>
|
||||||
|
|
||||||
{{ if .UnknownId }}
|
{{ if .UnknownId }}
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
<h2>Přihlášení</h2>
|
<h2>Přihlášení</h2>
|
||||||
|
|
||||||
<form method=post>
|
<form method=post>
|
||||||
<label for=password>Heslo:</label>
|
<label for=password>Heslo:</label>
|
||||||
<input type=password name=password id=password autofocus
|
<input type=password name=password id=password autofocus
|
||||||
><input type=submit value="Přihlásit">
|
><input type=submit value="Přihlásit">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{{ if .IncorrectPassword }}
|
{{ if .IncorrectPassword }}
|
||||||
|
|
|
@ -103,8 +103,11 @@ func handleContainer(w http.ResponseWriter, r *http.Request) {
|
||||||
var err error
|
var err error
|
||||||
if r.Method == http.MethodPost {
|
if r.Method == http.MethodPost {
|
||||||
err = handleContainerPost(r)
|
err = handleContainerPost(r)
|
||||||
// XXX: This is rather ugly. When removing, we want to keep
|
// FIXME: This is rather ugly. When removing, we want to keep
|
||||||
// the context id, in addition to the id being changed.
|
// the context id, in addition to the id being changed.
|
||||||
|
// TODO: If there were no errors, redirect the user to GET,
|
||||||
|
// which is related to the previous comment.
|
||||||
|
// TODO: If there were errors, use the last data as a prefill.
|
||||||
} else if r.Method != http.MethodGet {
|
} else if r.Method != http.MethodGet {
|
||||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
{{ define "Title" }}„{{ .Query }}“ — Vyhledávání{{ end }}
|
{{ define "Title" }}„{{ .Query }}“ — Vyhledávání{{ end }}
|
||||||
{{ define "Content" }}
|
{{ define "Content" }}
|
||||||
|
|
||||||
<h2>Vyhledávání: „{{ .Query }}“<h2>
|
<h2>Vyhledávání: „{{ .Query }}“</h2>
|
||||||
|
|
||||||
<h3>Řady</h3>
|
<h3>Řady</h3>
|
||||||
|
|
||||||
{{ range .Series }}
|
{{ range .Series }}
|
||||||
<section>
|
<section>
|
||||||
<header>
|
<header>
|
||||||
<h3><a href="series?prefix={{ .Prefix }}">{{ .Prefix }}</a></h3>
|
<h3><a href="series?prefix={{ .Prefix }}">{{ .Prefix }}</a></h3>
|
||||||
<p>{{ .Description }}
|
<p>{{ .Description }}
|
||||||
</header>
|
</header>
|
||||||
</section>
|
</section>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>Neodpovídají žádné řady.
|
<p>Neodpovídají žádné řady.
|
||||||
|
@ -20,16 +20,16 @@
|
||||||
|
|
||||||
{{ range .Containers }}
|
{{ range .Containers }}
|
||||||
<section>
|
<section>
|
||||||
<header>
|
<header>
|
||||||
<h3><a href="container?id={{ .Id }}">{{ .Id }}</a>
|
<h3><a href="container?id={{ .Id }}">{{ .Id }}</a>
|
||||||
{{ range .Path }}
|
{{- range .Path }}
|
||||||
<small>« <a href="container?id={{ . }}">{{ . }}</a></small>
|
<small>« <a href="container?id={{ . }}">{{ . }}</a></small>
|
||||||
{{ end }}
|
{{- end }}
|
||||||
</h3>
|
</h3>
|
||||||
</header>
|
</header>
|
||||||
{{ if .Description }}
|
{{- if .Description }}
|
||||||
<p>{{ .Description }}
|
<p>{{ .Description }}
|
||||||
{{ end }}
|
{{- end }}
|
||||||
</section>
|
</section>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>Neodpovídají žádné obaly.
|
<p>Neodpovídají žádné obaly.
|
||||||
|
|
|
@ -22,32 +22,30 @@
|
||||||
<p>{{ .Description }}
|
<p>{{ .Description }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<form method=post action="series">
|
<form method=post action="series">
|
||||||
<header>
|
<header>
|
||||||
<h3>Nová řada</h3>
|
<h3>Nová řada</h3>
|
||||||
<input type=text name=prefix placeholder="Prefix řady">
|
<input type=text name=prefix placeholder="Prefix řady">
|
||||||
<input type=text name=description placeholder="Popis řady"
|
<input type=text name=description placeholder="Popis řady"
|
||||||
><input type=submit value="Uložit">
|
><input type=submit value="Uložit">
|
||||||
|
</header>
|
||||||
</form>
|
</form>
|
||||||
</header>
|
|
||||||
</form>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{{ range .AllSeries }}
|
{{ range .AllSeries }}
|
||||||
<section>
|
<section>
|
||||||
<header>
|
<header>
|
||||||
<h3><a href="series?prefix={{ .Prefix }}">{{ .Prefix }}</a></h3>
|
<h3><a href="series?prefix={{ .Prefix }}">{{ .Prefix }}</a></h3>
|
||||||
{{ with $count := len .Containers }}
|
{{- with $count := len .Containers }}
|
||||||
{{ if eq $count 1 }}
|
{{- if eq $count 1 }}
|
||||||
<p>{{ $count }} obal
|
<p>{{ $count }} obal
|
||||||
{{ else if and (ge $count 2) (le $count 4) }}
|
{{- else if and (ge $count 2) (le $count 4) }}
|
||||||
<p>{{ $count }} obaly
|
<p>{{ $count }} obaly
|
||||||
{{ else if gt $count 0 }}
|
{{- else if gt $count 0 }}
|
||||||
<p>{{ $count }} obalů
|
<p>{{ $count }} obalů
|
||||||
{{ end }}
|
{{- end }}
|
||||||
{{ end }}
|
{{- end }}
|
||||||
<form method=post action="series?prefix={{ .Prefix }}">
|
<form method=post action="series?prefix={{ .Prefix }}">
|
||||||
<input type=text name=description value="{{ .Description }}"
|
<input type=text name=description value="{{ .Description }}"
|
||||||
><input type=submit value="Uložit">
|
><input type=submit value="Uložit">
|
||||||
|
@ -55,12 +53,11 @@
|
||||||
<form method=post action="series?prefix={{ .Prefix }}&remove">
|
<form method=post action="series?prefix={{ .Prefix }}&remove">
|
||||||
<input type=submit value="Odstranit">
|
<input type=submit value="Odstranit">
|
||||||
</form>
|
</form>
|
||||||
</header>
|
</header>
|
||||||
</section>
|
</section>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>Nejsou žádné řady.
|
<p>Nejsou žádné řady.
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in New Issue