Example #1
0
func register(w http.ResponseWriter, req *http.Request) {
	req.ParseForm()
	context := appengine.NewContext(req)

	team := Team{
		Date:        time.Now(),
		Name:        req.FormValue("name"),
		Email:       req.FormValue("email"),
		Phonenumber: req.FormValue("phone"),

		PartnerName:        req.FormValue("partner-name"),
		PartnerEmail:       req.FormValue("partner-email"),
		PartnerPhonenumber: req.FormValue("partner-phone"),
		Tech:               strings.Join(req.Form["tech"], ","),
		TeamDescrition:     req.FormValue("descript"),
		TeamWish:           req.FormValue("wish"),
	}
	// TODO make vaildater
	key := datastore.NewIncompleteKey(context, "3rd", getDataStoreKey(context))

	_, err := datastore.Put(context, key, &team)

	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	} else {
		view.Render(w, "main", RenderData{Mode: "pc"})
		return
	}
}
Example #2
0
func handler(w http.ResponseWriter, r *http.Request) {
	detect := gomobiledetect.NewMobileDetect(r, nil)
	if detect.IsMobile() {
		// do some mobile stuff
		view.Render(w, "main", RenderData{Mode: "mobile"})
		return
	}
	/*
		if detect.IsTablet() {
			// do some tablet stuff
			view.Render(w, "main", RenderData{Mode:"pc"});
			return;
		}
		deviceProperty := "iPhone"
		if detect.VersionFloat(deviceProperty) > 6 {
			// do something with iPhone v6
			view.Render(w, "mobile", RenderData{Mode: "mobile"});
			return;
		}*/
	view.Render(w, "main", RenderData{Mode: "pc"})
	return
}