diff options
author | Přemysl Janouch <p@janouch.name> | 2019-04-14 19:12:31 +0200 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2019-04-14 19:48:32 +0200 |
commit | 3d98454543f4494fd267e851b48d58a05aea11dc (patch) | |
tree | dd6fb2fa02650abbbf098ea356974045002b5088 /sklad/main.go | |
parent | fbb76679f36963daea01ef65bd939846d42b0cc1 (diff) | |
download | sklad-3d98454543f4494fd267e851b48d58a05aea11dc.tar.gz sklad-3d98454543f4494fd267e851b48d58a05aea11dc.tar.xz sklad-3d98454543f4494fd267e851b48d58a05aea11dc.zip |
sklad: cleanup, add comment
Child containers now show a linear list of subcontainers.
Diffstat (limited to 'sklad/main.go')
-rw-r--r-- | sklad/main.go | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/sklad/main.go b/sklad/main.go index a2a7143..1a9442a 100644 --- a/sklad/main.go +++ b/sklad/main.go @@ -92,35 +92,24 @@ func handleContainer(w http.ResponseWriter, r *http.Request) { allSeries[s.Prefix] = s.Description } + var container *Container children := []*Container{} - id := ContainerId(r.FormValue("id")) - description := "" - series := "" - parent := ContainerId("") - if id == "" { - children = indexChildren[id] - } else if container, ok := indexContainer[id]; ok { - children = indexChildren[id] - description = container.Description - series = container.Series - parent = container.Parent + if id := ContainerId(r.FormValue("id")); id == "" { + children = indexChildren[""] + } else if c, ok := indexContainer[id]; ok { + children = c.Children() + container = c } params := struct { - Id ContainerId - Description string - Children []*Container - Series string - Parent ContainerId - AllSeries map[string]string + Container *Container + Children []*Container + AllSeries map[string]string }{ - Id: id, - Description: description, - Children: children, - Series: series, - Parent: parent, - AllSeries: allSeries, + Container: container, + Children: children, + AllSeries: allSeries, } executeTemplate("container.tmpl", w, ¶ms) @@ -171,6 +160,7 @@ func handleSearch(w http.ResponseWriter, r *http.Request) { _ = query // TODO: Query the database for exact matches and fulltext. + // - Will want to show the full path from the root "" container. params := struct{}{} |