func All(rw http.ResponseWriter, req *http.Request, r render.Render) { ctx := appengine.NewContext(req) con, err := content.All(ctx) if err != nil { http.Error(rw, err.Error(), http.StatusInternalServerError) return } if con == nil { con = make([]content.Content, 0) } r.JSON(200, con) }
func Index(rw http.ResponseWriter, req *http.Request, r render.Render) { c := appengine.NewContext(req) con, err := content.All(c) if err != nil { http.Redirect(rw, req, "/admin?error="+err.Error(), http.StatusFound) return } bag := make(map[string]interface{}, 0) bag["Host"] = req.URL.Host bag["Admin"] = true bag["Content"] = con bag["ActiveNav"] = "content" r.HTML(200, "admin/content/index", bag) return }