Пример #1
0
// 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
// 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
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
// 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)
}