diff --git a/route_handlers.go b/route_handlers.go index fa7f848..03206bd 100644 --- a/route_handlers.go +++ b/route_handlers.go @@ -134,7 +134,6 @@ func addFormHandler(w http.ResponseWriter, r *http.Request, user *user.User, ses flashes := GetFlashes(session) session.Save(r, w) - var url = r.URL.Query().Get("url") reHttp := regexp.MustCompile("^https?://") if url != "" && !reHttp.Match([]byte(url)) { @@ -165,7 +164,6 @@ func addPostHandler(w http.ResponseWriter, r *http.Request, user *user.User, ses news.Category_id = category_id err = (&news).Insert(db) - err = errors.New("test") if err != nil { var flashes = make(map[string]interface{}) flashes["error"] = []string{ "Error saving news: "+err.Error() } @@ -187,16 +185,15 @@ func editFormHandler(w http.ResponseWriter, r *http.Request, user *user.User, se categories.LoadCategories(db) flashes := GetFlashes(session) - title := session.Values["title"] - delete(session.Values, "title") - link := session.Values["link"] - delete(session.Values, "link") - notes := session.Values["notes"] - delete(session.Values, "notes") - category := session.Values["category"] - delete(session.Values, "category") session.Save(r, w) + id, idErr := strconv.Atoi(r.FormValue("id")) + if idErr != nil { + + } + + newsItem := news.Get(id) + if link != nil { //TODO category_id ShowTemplate("add", w, map[string]interface{}{"user": user, "flashes": flashes, "categories": categories.CategoriesTree, "link": link, "title": title, "notes": notes, "popup": false, "category": category})