Created
March 15, 2014 10:08
-
-
Save slene/9564493 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Profile(params martini.Params, r render.Render, req *http.Request, data base.TmplData, session sessions.Session) { | |
data["Title"] = "Profile" | |
// TODO: Need to check view self or others. | |
user, err := models.GetUserByName(params["username"]) | |
if err != nil { | |
log.Handle(200, "user.Profile", data, r, err) | |
return | |
} | |
data["Owner"] = user | |
req.ParseForm() | |
tab := req.Form.Get("tab") | |
data["TabName"] = tab | |
switch tab { | |
case "activity": | |
feeds, err := models.GetFeeds(user.Id, 0, true) | |
if err != nil { | |
log.Handle(200, "user.Profile", data, r, err) | |
return | |
} | |
data["Feeds"] = feeds | |
default: | |
} | |
r.HTML(200, "user/profile", data) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Profile(ctx *context.Context, params martini.Params) { | |
ctx.Data["Title"] = "Profile" | |
// TODO: Need to check view self or others. | |
user, err := models.GetUserByName(params["username"]) | |
if err != nil { | |
ctx.Log(200, "user.Profile", err) | |
return | |
} | |
ctx.Data["Owner"] = user | |
tab := ctx.Query("tab") | |
ctx.Data["TabName"] = tab | |
switch tab { | |
case "activity": | |
feeds, err := models.GetFeeds(user.Id, 0, true) | |
if err != nil { | |
ctx.Log(200, "user.Profile", err) | |
return | |
} | |
ctx.Data["Feeds"] = feeds | |
default: | |
} | |
ctx.Render.HTML(200, "user/profile", ctx.Data) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment