예제 #1
0
func Show(env Env) (status Status, headers Headers, body Body) {
	id := env.Request().URL.Query().Get(":id")

	apiUser, err := services.GetUser(id)
	if err != nil {
		panic(err)
	}

	apiNotes, err := services.GetUserNotes(id)
	if err != nil {
		panic(err)
	}

	apiPosts, err := services.GetUserPosts(id)
	if err != nil {
		panic(err)
	}

	userViewData := &UserViewData{
		ApiUser:   apiUser,
		ApiNotes:  apiNotes,
		ApiPosts:  apiPosts,
		NewPostId: bson.NewObjectId().Hex(),
		IsCurrent: services.IsCurrentUserWithId(env, id),
	}

	mangotemplate.ForRender(env, "users/show", userViewData)
	return
}
예제 #2
0
func Edit(env Env) (status Status, headers Headers, body Body) {
	id := services.FetchUserIdFromSession(env)

	apiUser, err := services.GetUser(id)
	if err != nil {
		panic(err)
	}

	userViewData := &UserViewData{
		ApiUser:            apiUser,
		SkinTextureOptions: global.SkinTextureOptions,
		HairTextureOptions: global.HairTextureOptions,
	}

	mangotemplate.ForRender(env, "users/edit", userViewData)
	return
}