Skip to content

Commit

Permalink
Google+ Profile support
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Nov 25, 2011
1 parent c744e9a commit c29bead
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Handler/Profile.hs
Expand Up @@ -79,8 +79,11 @@ userForm maxY u = renderTable $ User
<*> aopt doubleField "Latitude"
{ fsId = Just "latitude"
} (Just $ userLatitude u)
<*> aopt (checkBool validGooglePlus ("Not a Google+ link" :: T.Text) urlField)
"Google+ Profile Link" (Just $ userGooglePlus u)
where
empOpts = map (pack . prettyEmployment &&& id) [minBound..maxBound]
validGooglePlus t = "https://plus.google.com/" `T.isPrefixOf` t

getProfileR :: Handler RepHtml
getProfileR = do
Expand Down
1 change: 1 addition & 0 deletions Haskellers.hs
Expand Up @@ -422,6 +422,7 @@ instance YesodAuth Haskellers where
, userLocation = Nothing
, userLongitude = Nothing
, userLatitude = Nothing
, userGooglePlus = Nothing
}
addBIDEmail uid
_ <- insert $ Ident (credsIdent creds) uid
Expand Down
1 change: 1 addition & 0 deletions entities
Expand Up @@ -16,6 +16,7 @@ User
location Text Maybe
longitude Double Maybe Ne
latitude Double Maybe Ne
googlePlus Text Maybe
Username
user UserId
username Text
Expand Down
3 changes: 3 additions & 0 deletions hamlet/user.hamlet
Expand Up @@ -27,6 +27,9 @@ $if viewerIsAdmin
$maybe w <- userWebsite u
<div .website>
<a href="#{w}">#{w}
$maybe gp <- userGooglePlus u
<div .googleplus>
<a href=#{gp}>Google+ Profile
$maybe e <- userEmployment u
<div .employment>#{e}
$maybe l <- userLocation u
Expand Down

0 comments on commit c29bead

Please sign in to comment.