changed profile handling
This commit is contained in:
parent
a992307327
commit
299bc3903a
3 changed files with 27 additions and 18 deletions
|
@ -1,13 +1,18 @@
|
||||||
module Handler.Profile where
|
module Handler.Profile where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
import Data.Maybe
|
||||||
|
|
||||||
getProfileR :: UserId -> Handler Html
|
getProfileR :: UserId -> Handler Html
|
||||||
getProfileR userId = error "reworking logic" -- do
|
getProfileR user = do
|
||||||
-- msu <- lookupSession "id"
|
owner <- runDB $ get user
|
||||||
-- case msu of
|
ownerName <- lift $ pure $ userName $ fromJust owner
|
||||||
-- Just tempUserId -> do
|
userAlbums <- runDB $ selectList [AlbumOwner ==. user] [Desc AlbumTitle]
|
||||||
-- userId <- Key $ PersistInt64 $ fromIntegral tempUserId
|
recentMedia <- (runDB $ selectList [MediumOwner ==. user] [Desc MediumTime])
|
||||||
-- userMedia <- runDB $ selectList [MediumOwner ==. userId] [Desc MediumTime]
|
msu <- lookupSession "userId"
|
||||||
-- defaultLayout $ do
|
case msu of
|
||||||
-- $(widgetFile "profile")
|
Just tempUserId -> do
|
||||||
|
userId <- lift $ pure $ getUserIdFromText tempUserId
|
||||||
|
presence <- lift $ pure $ (Key userId) == user
|
||||||
|
defaultLayout $ do
|
||||||
|
$(widgetFile "profile")
|
||||||
|
|
|
@ -12,6 +12,7 @@ Album
|
||||||
title Text
|
title Text
|
||||||
owner UserId
|
owner UserId
|
||||||
content [MediumId]
|
content [MediumId]
|
||||||
|
samplePic MediumId Maybe
|
||||||
deriving
|
deriving
|
||||||
Medium
|
Medium
|
||||||
title Text
|
title Text
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
$newline always
|
$newline always
|
||||||
<h3>Profile of #{username}
|
<h3>Profile of #{ownerName}
|
||||||
|
|
||||||
$if msu == (Just username)
|
$if null userAlbums
|
||||||
Coming soon: create new album
|
This user has no albums yet
|
||||||
<br>
|
|
||||||
|
|
||||||
$if null userMedia
|
|
||||||
Dieser Benutzer hat noch keine Medien hochgeladen.
|
|
||||||
$else
|
$else
|
||||||
Neueste Medien:
|
Albums of this user:
|
||||||
$forall (Entity mediaId medium) <- userMedia
|
$forall (Entity albumId album) <- userAlbums
|
||||||
<div class="thumbnails">
|
<div class="thumbnails">
|
||||||
<div class="single">
|
|
||||||
|
$if null recentMedia
|
||||||
|
This user has not uploaded any images
|
||||||
|
$else
|
||||||
|
Newest images:
|
||||||
|
$forall (Entity mediaId medium) <- take 10 recentMedia
|
||||||
|
<div class="thumbnails">
|
||||||
|
<img src=#{mediumPath medium}>
|
||||||
|
|
Loading…
Reference in a new issue