This commit is contained in:
Dan Ballard 2015-09-18 08:48:38 -07:00
parent 233b24d561
commit 0263f55073
1 changed files with 7 additions and 10 deletions

View File

@ -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})