aboutsummaryrefslogtreecommitdiff
path: root/garage.go
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-09-26 08:40:30 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-09-26 08:40:30 +0200
commitd8633d7fb89b55996f25e1a67180408c805ba15f (patch)
tree50c7b637e1f89c6ffcf8fcc7bf99429e91c944ef /garage.go
parent982bd8a43c50bb5845b694dbd0b3e0ffbf43dad7 (diff)
downloadguichet-d8633d7fb89b55996f25e1a67180408c805ba15f.tar.gz
guichet-d8633d7fb89b55996f25e1a67180408c805ba15f.zip
final
Diffstat (limited to 'garage.go')
-rw-r--r--garage.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/garage.go b/garage.go
index b3ca836..236dcbd 100644
--- a/garage.go
+++ b/garage.go
@@ -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)