typos, gitignore for intelij
This commit is contained in:
parent
f9ab27e32a
commit
8f9969b4cc
|
@ -3,6 +3,8 @@ transmet
|
||||||
db/dbconf.yml
|
db/dbconf.yml
|
||||||
.Rhistory
|
.Rhistory
|
||||||
.project
|
.project
|
||||||
|
*.iml
|
||||||
|
.idea
|
||||||
*~
|
*~
|
||||||
*.o
|
*.o
|
||||||
*.a
|
*.a
|
||||||
|
|
|
@ -42,6 +42,11 @@ func (news *News) Insert(db *sql.DB) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Delete(db *sql.DB, id int) error {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func nullStringToString(str *sql.NullString) string {
|
func nullStringToString(str *sql.NullString) string {
|
||||||
if str.Valid {
|
if str.Valid {
|
||||||
return str.String
|
return str.String
|
||||||
|
|
|
@ -242,16 +242,16 @@ func deleteHandler(w http.ResponseWriter, r *http.Request, user *user.User, sess
|
||||||
if idErr != nil {
|
if idErr != nil {
|
||||||
session.AddFlash("Invalid news to delete", flash_err)
|
session.AddFlash("Invalid news to delete", flash_err)
|
||||||
} else {
|
} else {
|
||||||
err := categories.Delete(db, id)
|
err := news.Delete(db, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
session.AddFlash("Error commiting to Database", flash_err)
|
session.AddFlash("Error commiting to Database", flash_err)
|
||||||
} else {
|
} else {
|
||||||
session.AddFlash("Deleted category", flash_info)
|
session.AddFlash("Deleted news post", flash_info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session.Save(r, w)
|
session.Save(r, w)
|
||||||
http.Redirect(w, r, "/categories", http.StatusFound)
|
http.Redirect(w, r, "/", http.StatusFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ func init_route_handlers() {
|
||||||
r.HandleFunc("/export", userHandler(templateFormHandler))
|
r.HandleFunc("/export", userHandler(templateFormHandler))
|
||||||
r.HandleFunc("/export-commit", userHandler(exportHandler))
|
r.HandleFunc("/export-commit", userHandler(exportHandler))
|
||||||
r.HandleFunc("/added", userHandler(addedHandler))
|
r.HandleFunc("/added", userHandler(addedHandler))
|
||||||
r.handleFunc("/delete", userHandler(deleteHandler))
|
r.HandleFunc("/delete", userHandler(deleteHandler))
|
||||||
|
|
||||||
r.HandleFunc("/categories", getPostHandler(userHandler(categoriesFormHandler), userHandler(categoriesPostHandler)))
|
r.HandleFunc("/categories", getPostHandler(userHandler(categoriesFormHandler), userHandler(categoriesPostHandler)))
|
||||||
r.HandleFunc("/categories/change-parent", userHandler(categoryChangeParentHandler))
|
r.HandleFunc("/categories/change-parent", userHandler(categoryChangeParentHandler))
|
||||||
|
|
Loading…
Reference in New Issue