diff options
Diffstat (limited to 'garage.go')
-rw-r--r-- | garage.go | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -194,9 +194,8 @@ func handleWebsiteList(w http.ResponseWriter, r *http.Request) { return } - desc := ctrl.Describe() - if len(desc.Websites) > 0 { - http.Redirect(w, r, "/website/inspect/"+desc.Websites[0].Pretty, http.StatusFound) + if len(ctrl.PrettyList) > 0 { + http.Redirect(w, r, "/website/inspect/"+ctrl.PrettyList[0], http.StatusFound) } else { http.Redirect(w, r, "/website/new", http.StatusFound) } @@ -245,7 +244,7 @@ func handleWebsiteNew(w http.ResponseWriter, r *http.Request) { } type WebsiteInspectTpl struct { - Ctrl *WebsiteController + Describe *WebsiteDescribe View *WebsiteView Err error } @@ -287,8 +286,14 @@ func handleWebsiteInspect(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } + + describe, err := ctrl.Describe() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } - tpl := &WebsiteInspectTpl{ ctrl, view, processErr } + tpl := &WebsiteInspectTpl{ describe, view, processErr } tWebsiteInspect := getTemplate("garage_website_inspect.html") tWebsiteInspect.Execute(w, &tpl) |