2017-05-06 21:21:39 +02:00
package router
2017-05-07 01:20:13 +02:00
import (
2017-05-07 00:10:40 +02:00
"html/template"
2017-05-06 21:21:39 +02:00
"net/http"
2017-05-07 00:10:40 +02:00
"github.com/ewhal/nyaa/service/user/form"
"github.com/ewhal/nyaa/util/modelHelper"
2017-05-07 02:32:32 +02:00
"github.com/ewhal/nyaa/util/languages"
2017-05-07 00:10:40 +02:00
"github.com/gorilla/mux"
2017-05-06 21:21:39 +02:00
)
2017-05-07 02:32:32 +02:00
var viewRegisterTemplate = template . Must ( template . New ( "userRegister" ) . Funcs ( FuncMap ) . ParseFiles ( "templates/index.html" , "templates/user/register.html" ) )
2017-05-07 00:10:40 +02:00
//var viewTemplate = template.Must(template.New("view").Funcs(FuncMap).ParseFiles("templates/index.html", "templates/view.html"))
//var viewTemplate = template.Must(template.New("view").Funcs(FuncMap).ParseFiles("templates/index.html", "templates/view.html"))
2017-05-07 01:20:13 +02:00
func init ( ) {
template . Must ( viewRegisterTemplate . ParseGlob ( "templates/_*.html" ) )
}
2017-05-06 21:21:39 +02:00
// Getting View User Registration
func UserRegisterFormHandler ( w http . ResponseWriter , r * http . Request ) {
2017-05-07 00:10:40 +02:00
b := form . RegistrationForm { }
2017-05-07 02:32:32 +02:00
modelHelper . BindValueForm ( & b , r )
languages . SetTranslation ( "en-us" , viewRegisterTemplate )
2017-05-07 01:20:13 +02:00
htv := UserRegisterTemplateVariables { b , NewSearchForm ( ) , Navigation { } , r . URL , mux . CurrentRoute ( r ) }
2017-05-07 00:10:40 +02:00
err := viewTemplate . ExecuteTemplate ( w , "index.html" , htv )
if err != nil {
http . Error ( w , err . Error ( ) , http . StatusInternalServerError )
}
2017-05-06 21:21:39 +02:00
}
// Getting View User Login
func UserLoginFormHandler ( w http . ResponseWriter , r * http . Request ) {
}
// Getting User Profile
func UserProfileHandler ( w http . ResponseWriter , r * http . Request ) {
}
2017-05-07 01:20:13 +02:00
// Getting View User Profile Update
2017-05-06 21:21:39 +02:00
func UserProfileFormHandler ( w http . ResponseWriter , r * http . Request ) {
}
// Post Registration controller
func UserRegisterPostHandler ( w http . ResponseWriter , r * http . Request ) {
}
// Post Login controller
func UserLoginPostHandler ( w http . ResponseWriter , r * http . Request ) {
}
// Post Profule Update controller
func UserProfilePostHandler ( w http . ResponseWriter , r * http . Request ) {
}