aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2019-04-22 10:09:08 +0200
committerPřemysl Janouch <p@janouch.name>2019-04-22 10:09:08 +0200
commit7d2ca09d1b0c4696cf04023a80dc8f3dfa33bbb9 (patch)
treebaf234c96d9a5a969494a782c53d632693128505 /cmd
parent4ad4bcf9e706703fff64fde77f97ee4067a5765b (diff)
downloadsklad-7d2ca09d1b0c4696cf04023a80dc8f3dfa33bbb9.tar.gz
sklad-7d2ca09d1b0c4696cf04023a80dc8f3dfa33bbb9.tar.xz
sklad-7d2ca09d1b0c4696cf04023a80dc8f3dfa33bbb9.zip
sklad: show the context when deleting containers
Do not try to show the deleted container.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/sklad/main.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/sklad/main.go b/cmd/sklad/main.go
index 83b9213..8a7e939 100644
--- a/cmd/sklad/main.go
+++ b/cmd/sklad/main.go
@@ -107,6 +107,12 @@ func handleContainerPost(r *http.Request) error {
}
func handleContainer(w http.ResponseWriter, r *http.Request) {
+ // When deleting, do not try to show the deleted entry but the context.
+ shownId := r.FormValue("context")
+ if shownId == "" {
+ shownId = r.FormValue("id")
+ }
+
var err error
if r.Method == http.MethodPost {
err = handleContainerPost(r)
@@ -128,7 +134,7 @@ func handleContainer(w http.ResponseWriter, r *http.Request) {
var container *Container
children := indexChildren[""]
- if c, ok := indexContainer[ContainerId(r.FormValue("id"))]; ok {
+ if c, ok := indexContainer[ContainerId(shownId)]; ok {
children = c.Children()
container = c
}