Ejemplo n.º 1
0
//EditController contains logic for the Edit action
func EditController(w http.ResponseWriter, r *http.Request, title string) {
	p, err := models.LoadPage(title)
	if err != nil {
		p = &models.Page{Title: title}
	}
	helpers.RenderView(w, "edit", p)
}
Ejemplo n.º 2
0
//ViewController contains logic for the View action
func ViewController(w http.ResponseWriter, r *http.Request, title string) {
	p, err := models.LoadPage(title)
	if err != nil {
		http.Redirect(w, r, "/edit/"+title, http.StatusFound)
		return
	}
	helpers.RenderView(w, "view", p)
}