profilesite working

This commit is contained in:
nek0 2014-08-17 22:58:33 +02:00
parent e11dc798a5
commit 2c99c0fe6b
3 changed files with 9 additions and 3 deletions

View file

@ -7,7 +7,7 @@ getProfileR :: UserId -> Handler Html
getProfileR user = do
owner <- runDB $ get user
ownerName <- lift $ pure $ userName $ fromJust owner
userAlbums <- runDB $ selectList [AlbumOwner ==. user] [Desc AlbumTitle]
userAlbs <- runDB $ selectList [AlbumOwner ==. user] [Desc AlbumTitle]
recentMedia <- (runDB $ selectList [MediumOwner ==. user] [Desc MediumTime])
msu <- lookupSession "userId"
case msu of
@ -16,3 +16,6 @@ getProfileR user = do
presence <- lift $ pure $ userId == user
defaultLayout $ do
$(widgetFile "profile")
Nothing ->
defaultLayout $ do
$(widgetFile "profile")

BIN
static/img/album.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 KiB

View file

@ -1,12 +1,15 @@
$newline always
<h3>Profile of #{ownerName}
$if null userAlbums
$if null userAlbs
This user has no albums yet
$else
Albums of this user:
$forall (Entity albumId album) <- userAlbums
$forall (Entity albumId album) <- userAlbs
<div class="thumbnails">
<a href=@{AlbumR user albumId}>
<img width="200px" src="/static/img/album.jpg"><br>
#{albumTitle album}
$if null recentMedia
This user has not uploaded any images