예제 #1
0
func changeProjectHandler(w http.ResponseWriter, r *http.Request) {
	data := setDefaultData(w, r)
	projectId := r.URL.Query().Get("id")
	project := project.FindProject(projectId)
	data["project"] = project
	//data["castLength"] = len(project.Cast)
	display(w, "changeProject", &Page{Title: project.Title, Data: data})
}
예제 #2
0
func deleteProjectHandler(w http.ResponseWriter, r *http.Request) {
	s := redis_session.Session(w, r)
	currentUser := user.FindUser(s.Get("Email"))
	projectID := r.URL.Query().Get("id")
	selected := project.FindProject(projectID)
	project.DeleteProject(selected)
	urlParts := []string{"/projects/edit/?id=", currentUser.Id.Hex()}
	url := strings.Join(urlParts, "")
	http.Redirect(w, r, url, http.StatusTemporaryRedirect)
}
예제 #3
0
func projectHandler(w http.ResponseWriter, r *http.Request) {
	s := redis_session.Session(w, r)
	currentUser := user.FindUser(s.Get("Email"))
	data := setDefaultData(w, r)
	projectID := r.URL.Query().Get("id")
	project := project.FindProject(projectID)
	//fmt.Println("check below this line")
	data["youtubeCode"] = project.GetYoutubeID() // causes error,need to find better way
	data["project"] = project
	data["user"] = currentUser
	//data["author"] = user.FindUser(project.UserEmail)
	//fmt.Println(role.Comment)
	display(w, "viewProject", &Page{Title: "Project", Data: data})
}