album site
This commit is contained in:
parent
6d7257156f
commit
cc6d60e08d
2 changed files with 35 additions and 0 deletions
19
Handler/Album.hs
Normal file
19
Handler/Album.hs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
module Handler.Album where
|
||||||
|
|
||||||
|
import Import
|
||||||
|
|
||||||
|
getAlbumR :: UserId -> AlbumId -> Handler Html
|
||||||
|
getAlbumR ownerId albumId = do
|
||||||
|
owner <- runDB $ getJust ownerId
|
||||||
|
ownerName <- lift $ pure $ userName owner
|
||||||
|
album <- runDB $ getJust albumId
|
||||||
|
msu <- lookupSession "userId"
|
||||||
|
presence <- case msu of
|
||||||
|
Just tempUserId -> do
|
||||||
|
userId <- lift $ pure $ getUserIdFromText tempUserId
|
||||||
|
return (userId == ownerId)
|
||||||
|
Nothing ->
|
||||||
|
return False
|
||||||
|
media <- mapM (\a -> runDB $ getJust a) (albumContent album)
|
||||||
|
defaultLayout $ do
|
||||||
|
$(widgetFile "album")
|
16
templates/album.hamlet
Normal file
16
templates/album.hamlet
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
$newline never
|
||||||
|
<h3>#{albumTitle album}
|
||||||
|
by <a href=@{ProfileR ownerId}>#{ownerName}</a>
|
||||||
|
<br>
|
||||||
|
$if presence == True
|
||||||
|
TODO: direct Upload to this album
|
||||||
|
<br>
|
||||||
|
$if null media
|
||||||
|
This album is empty
|
||||||
|
$else
|
||||||
|
Images in this album:
|
||||||
|
$forall (medium) <- media
|
||||||
|
<div class="thumbnails">
|
||||||
|
<a href=#{mediumPath medium}>
|
||||||
|
<img src=#{mediumPath medium}><br>
|
||||||
|
#{mediumTitle medium}
|
Loading…
Reference in a new issue