diff --git a/route_handlers.go b/route_handlers.go index eb5b7e5..ebaeb8b 100644 --- a/route_handlers.go +++ b/route_handlers.go @@ -204,7 +204,7 @@ func editFormHandler(w http.ResponseWriter, r *http.Request, user *user.User, se } session.Save(r, w) - ShowTemplate("post", w, map[string]interface{}{"user": user, "flashes": flashes, "categories": categories.CategoriesTree, "link": newsItem.Url, "title": newsItem.Title, "notes": newsItem.Notes, "popup": false, "category": newsItem.Category_id, "id": newsItem.Id()}) + ShowTemplate("post", w, map[string]interface{}{"user": user, "flashes": flashes, "categories": categories.CategoriesTree, "link": newsItem.Url, "title": newsItem.Title, "notes": newsItem.Notes, "popup": false, "category_id": newsItem.Category_id, "id": newsItem.Id()}) return } @@ -225,8 +225,6 @@ func editPostHandler(w http.ResponseWriter, r *http.Request, user *user.User, se popup := r.FormValue("popup") - - category_id, err := strconv.Atoi(r.FormValue("category")) if err != nil { var flashes = make(map[string]interface{}) diff --git a/templates/pages/post.html b/templates/pages/post.html index badd676..a9a3412 100644 --- a/templates/pages/post.html +++ b/templates/pages/post.html @@ -11,7 +11,7 @@ @@ -24,8 +24,8 @@ {{define "option-category"}} - - {{range $child := $category.Children}} - {{template "option-category" dict "category" $child "category_id" .category_id}} - {{end}} + + {{range $child := .category.Children}} + {{template "option-category" dict "category" $child "category_id" $.category_id}} + {{end}} {{end}} \ No newline at end of file