From 21d01f4c4b10f82c65dccfba22f825640610d66e Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Tue, 16 Apr 2019 03:56:53 +0200 Subject: sklad: clean up templates --- cmd/sklad/container.tmpl | 172 +++++++++++++++++++++++++---------------------- cmd/sklad/label.tmpl | 1 + cmd/sklad/login.tmpl | 6 +- cmd/sklad/main.go | 5 +- cmd/sklad/search.tmpl | 30 ++++----- cmd/sklad/series.tmpl | 55 +++++++-------- 6 files changed, 139 insertions(+), 130 deletions(-) (limited to 'cmd') diff --git a/cmd/sklad/container.tmpl b/cmd/sklad/container.tmpl index 200bb19..f6d86ce 100644 --- a/cmd/sklad/container.tmpl +++ b/cmd/sklad/container.tmpl @@ -21,73 +21,73 @@ {{ end }} {{ if .Container }} -
-
-

{{ .Container.Id }} -{{ range .Container.Path }} - « {{ . }} -{{ end }} -

-
- -
-
- +
+

{{ .Container.Id }} + {{- range .Container.Path }} + « {{ . }} + {{- end }} +

+ + + +
+ +
+
+
+ +
+
+ + +
+
+ + +
+ +
-
- -
- -
-
- - -
-
- - -
- -
-

Podobaly

- {{ else }}
-
-

Nový obal

-
-
- -
-
- - -
-
- - -
- -
-
+
+

Nový obal

+
+
+ +
+
+ + +
+
+ + +
+ +
+

Obaly nejvyšší úrovně

@@ -95,28 +95,36 @@ {{ range .Children }}
-
-

{{ .Id }} -{{ range .Path }} - « {{ . }} -{{ end }} -

-
- -
-
- -
-
-{{ if .Description }} -

{{ .Description }} -{{ end }} -{{ if .Children }} -

-{{ range .Children }} -{{ .Id }} -{{ end }} -{{ end }} +

+

{{ .Id }} + {{- range .Path }} + « {{ . }} + {{- end }} +

+
+ {{- if $.Container }} + + {{- end }} + +
+
+ {{- if $.Container }} + + {{- end }} + +
+
+ + {{- if .Description }} +

{{ .Description }} + {{- end }} + + {{- if .Children }} +

+ {{- range .Children }} + {{ .Id }} + {{- end }} + {{- end }}

{{ else }}

Obal je prázdný. diff --git a/cmd/sklad/label.tmpl b/cmd/sklad/label.tmpl index 3880a03..08e971a 100644 --- a/cmd/sklad/label.tmpl +++ b/cmd/sklad/label.tmpl @@ -1,5 +1,6 @@ {{ define "Title" }}Tisk štítku{{ end }} {{ define "Content" }} +

Tisk štítku pro {{ .Id }}

{{ if .UnknownId }} diff --git a/cmd/sklad/login.tmpl b/cmd/sklad/login.tmpl index c34ab53..2c9ffc3 100644 --- a/cmd/sklad/login.tmpl +++ b/cmd/sklad/login.tmpl @@ -5,9 +5,9 @@

Přihlášení

- - + +
{{ if .IncorrectPassword }} diff --git a/cmd/sklad/main.go b/cmd/sklad/main.go index decd894..c08ce2b 100644 --- a/cmd/sklad/main.go +++ b/cmd/sklad/main.go @@ -103,8 +103,11 @@ func handleContainer(w http.ResponseWriter, r *http.Request) { var err error if r.Method == http.MethodPost { 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. + // 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 { w.WriteHeader(http.StatusMethodNotAllowed) return diff --git a/cmd/sklad/search.tmpl b/cmd/sklad/search.tmpl index 9fef455..0c58bf9 100644 --- a/cmd/sklad/search.tmpl +++ b/cmd/sklad/search.tmpl @@ -1,16 +1,16 @@ {{ define "Title" }}„{{ .Query }}“ — Vyhledávání{{ end }} {{ define "Content" }} -

Vyhledávání: „{{ .Query }}“

+

Vyhledávání: „{{ .Query }}“

Řady

{{ range .Series }}
-
-

{{ .Prefix }}

-

{{ .Description }} -

+
+

{{ .Prefix }}

+

{{ .Description }} +

{{ else }}

Neodpovídají žádné řady. @@ -20,16 +20,16 @@ {{ range .Containers }}

-
-

{{ .Id }} -{{ range .Path }} - « {{ . }} -{{ end }} -

-
-{{ if .Description }} -

{{ .Description }} -{{ end }} +

+

{{ .Id }} + {{- range .Path }} + « {{ . }} + {{- end }} +

+
+ {{- if .Description }} +

{{ .Description }} + {{- end }}

{{ else }}

Neodpovídají žádné obaly. diff --git a/cmd/sklad/series.tmpl b/cmd/sklad/series.tmpl index fbc0e91..8bfaddc 100644 --- a/cmd/sklad/series.tmpl +++ b/cmd/sklad/series.tmpl @@ -22,45 +22,42 @@

{{ .Description }} {{ end }} {{ else }} -

-
-
-

Nová řada

- - + +
+

Nová řada

+ + +
-
-
{{ range .AllSeries }}
-
-

{{ .Prefix }}

-{{ with $count := len .Containers }} -{{ if eq $count 1 }} -

{{ $count }} obal -{{ else if and (ge $count 2) (le $count 4) }} -

{{ $count }} obaly -{{ else if gt $count 0 }} -

{{ $count }} obalů -{{ end }} -{{ end }} -

- -
-
- -
-
+
+

{{ .Prefix }}

+ {{- with $count := len .Containers }} + {{- if eq $count 1 }} +

{{ $count }} obal + {{- else if and (ge $count 2) (le $count 4) }} +

{{ $count }} obaly + {{- else if gt $count 0 }} +

{{ $count }} obalů + {{- end }} + {{- end }} +

+ +
+
+ +
+
{{ else }}

Nejsou žádné řady. {{ end }} - {{ end }} {{ end }} -- cgit v1.2.3-70-g09d2