Compare commits
No commits in common. "1713bd1f06f3715c0cc6a7cda78bf27474765ed4" and "5b7113905ecdb1646ead78a05b1e10c5ebee9b6f" have entirely different histories.
1713bd1f06
...
5b7113905e
|
@ -36,9 +36,9 @@
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<form method=post action="container?id={{ .Container.Id }}">
|
<form method=post action="container?id={{ .Container.Id }}">
|
||||||
<textarea name=description rows="{{ max 5 (lines .Container.Description) }}"
|
<textarea name=description rows=5>
|
||||||
placeholder="Popis obalu nebo jeho obsahu">
|
{{ .Container.Description }}
|
||||||
{{ .Container.Description }}</textarea>
|
</textarea>
|
||||||
<footer>
|
<footer>
|
||||||
<div>
|
<div>
|
||||||
<label for=series>Řada:</label>
|
<label for=series>Řada:</label>
|
||||||
|
|
|
@ -1,6 +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 {{ .Id }}</h2>
|
||||||
|
|
||||||
{{ if .UnknownId }}
|
{{ if .UnknownId }}
|
||||||
<p>Neznámý obal.
|
<p>Neznámý obal.
|
||||||
|
|
|
@ -11,7 +11,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"janouch.name/sklad/imgutil"
|
"janouch.name/sklad/imgutil"
|
||||||
|
@ -74,9 +73,9 @@ func handleLogout(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func handleContainerPost(r *http.Request) error {
|
func handleContainerPost(r *http.Request) error {
|
||||||
id := ContainerId(r.FormValue("id"))
|
id := ContainerId(r.FormValue("id"))
|
||||||
description := strings.TrimSpace(r.FormValue("description"))
|
description := r.FormValue("description")
|
||||||
series := r.FormValue("series")
|
series := r.FormValue("series")
|
||||||
parent := ContainerId(strings.TrimSpace(r.FormValue("parent")))
|
parent := ContainerId(r.FormValue("parent"))
|
||||||
_, remove := r.Form["remove"]
|
_, remove := r.Form["remove"]
|
||||||
|
|
||||||
if container, ok := indexContainer[id]; ok {
|
if container, ok := indexContainer[id]; ok {
|
||||||
|
@ -151,8 +150,8 @@ func handleContainer(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleSeriesPost(r *http.Request) error {
|
func handleSeriesPost(r *http.Request) error {
|
||||||
prefix := strings.TrimSpace(r.FormValue("prefix"))
|
prefix := r.FormValue("prefix")
|
||||||
description := strings.TrimSpace(r.FormValue("description"))
|
description := r.FormValue("description")
|
||||||
_, remove := r.Form["remove"]
|
_, remove := r.Form["remove"]
|
||||||
|
|
||||||
if series, ok := indexSeries[prefix]; ok {
|
if series, ok := indexSeries[prefix]; ok {
|
||||||
|
@ -334,18 +333,6 @@ func handle(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var funcMap = template.FuncMap{
|
|
||||||
"max": func(i, j int) int {
|
|
||||||
if i > j {
|
|
||||||
return i
|
|
||||||
}
|
|
||||||
return j
|
|
||||||
},
|
|
||||||
"lines": func(s string) int {
|
|
||||||
return strings.Count(s, "\n") + 1
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Randomize the RNG for session string generation.
|
// Randomize the RNG for session string generation.
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
@ -368,8 +355,7 @@ func main() {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
for _, name := range m {
|
for _, name := range m {
|
||||||
templates[name] = template.Must(template.New("base.tmpl").
|
templates[name] = template.Must(template.ParseFiles("base.tmpl", name))
|
||||||
Funcs(funcMap).ParseFiles("base.tmpl", name))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
http.HandleFunc("/", handle)
|
http.HandleFunc("/", handle)
|
||||||
|
|
Loading…
Reference in New Issue