Compare commits
No commits in common. "04e66d7888f4567e004e4a6cf76765e8451c6a2d" and "4ad4bcf9e706703fff64fde77f97ee4067a5765b" have entirely different histories.
04e66d7888
...
4ad4bcf9e7
@ -107,23 +107,14 @@ func handleContainerPost(r *http.Request) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleContainer(w http.ResponseWriter, r *http.Request) {
|
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
|
var err error
|
||||||
if r.Method == http.MethodPost {
|
if r.Method == http.MethodPost {
|
||||||
if err = handleContainerPost(r); err == nil {
|
err = handleContainerPost(r)
|
||||||
redirect := "container"
|
// FIXME: This is rather ugly. When removing, we want to keep
|
||||||
if shownId != "" {
|
// the context id, in addition to the id being changed.
|
||||||
redirect += "?id=" + url.QueryEscape(shownId)
|
// TODO: If there were no errors, redirect the user to GET,
|
||||||
}
|
// which is related to the previous comment.
|
||||||
http.Redirect(w, r, redirect, http.StatusSeeOther)
|
// TODO: If there were errors, use the last data as a prefill.
|
||||||
return
|
|
||||||
}
|
|
||||||
// TODO: 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
|
||||||
@ -137,7 +128,7 @@ func handleContainer(w http.ResponseWriter, r *http.Request) {
|
|||||||
var container *Container
|
var container *Container
|
||||||
children := indexChildren[""]
|
children := indexChildren[""]
|
||||||
|
|
||||||
if c, ok := indexContainer[ContainerId(shownId)]; ok {
|
if c, ok := indexContainer[ContainerId(r.FormValue("id"))]; ok {
|
||||||
children = c.Children()
|
children = c.Children()
|
||||||
container = c
|
container = c
|
||||||
}
|
}
|
||||||
@ -197,10 +188,7 @@ func handleSeriesPost(r *http.Request) error {
|
|||||||
func handleSeries(w http.ResponseWriter, r *http.Request) {
|
func handleSeries(w http.ResponseWriter, r *http.Request) {
|
||||||
var err error
|
var err error
|
||||||
if r.Method == http.MethodPost {
|
if r.Method == http.MethodPost {
|
||||||
if err = handleSeriesPost(r); err == nil {
|
err = handleSeriesPost(r)
|
||||||
http.Redirect(w, r, "series", http.StatusSeeOther)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// XXX: This is rather ugly.
|
// XXX: This is rather ugly.
|
||||||
r.Form = url.Values{}
|
r.Form = url.Values{}
|
||||||
} else if r.Method != http.MethodGet {
|
} else if r.Method != http.MethodGet {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user