예제 #1
0
파일: clockin.go 프로젝트: atabek/gowebapp
// ClockinsByStudentIdJsonGET displays the note update page
func ClockinsByStudentIdGET(w http.ResponseWriter, r *http.Request) {
	// Get session
	sess := session.Instance(r)

	// Get the Student id
	var params httprouter.Params
	params = context.Get(r, "params").(httprouter.Params)
	studentID := params.ByName("student_id")

	// Get the clockins of a particular Student
	_, err := model.StudentBySID(html.EscapeString(studentID))

	if err != nil { // If the note doesn't exist
		log.Println(err)
		sess.AddFlash(view.Flash{"An error occurred on the server. Please try again later.", view.FlashError})
		sess.Save(r, w)
		http.Redirect(w, r, "/list", http.StatusFound)
		return
	}

	// Display the view
	v := view.New(r)
	v.Name = "clockins/student"
	v.Vars["token"] = csrfbanana.Token(w, r, sess)
	//v.Vars["student_id"] = studentID
	v.Render(w)
}
예제 #2
0
파일: clockin.go 프로젝트: atabek/gowebapp
// ClockinCreateGET displays the clockin creation page
func ClockinCreateGET(w http.ResponseWriter, r *http.Request) {
	// Get session
	sess := session.Instance(r)

	// Display the view
	v := view.New(r)
	v.Name = "clockin/create"
	v.Vars["token"] = csrfbanana.Token(w, r, sess)
	v.Render(w)
}
예제 #3
0
파일: login.go 프로젝트: atabek/gowebapp
func LoginGET(w http.ResponseWriter, r *http.Request) {
	// Get session
	sess := session.Instance(r)

	// Display the view
	v := view.New(r)
	v.Name = "login/login"
	v.Vars["token"] = csrfbanana.Token(w, r, sess)
	// Refill any form fields
	view.Repopulate([]string{"email"}, r.Form, v.Vars)
	v.Render(w)
}
예제 #4
0
파일: about.go 프로젝트: atabek/gowebapp
// Displays the About page
func AboutGET(w http.ResponseWriter, r *http.Request) {
	// Display the view
	v := view.New(r)
	v.Name = "about/about"
	v.Render(w)
}