diff --git a/Handler/Album.hs b/Handler/Album.hs new file mode 100644 index 0000000..988a2d8 --- /dev/null +++ b/Handler/Album.hs @@ -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") diff --git a/templates/album.hamlet b/templates/album.hamlet new file mode 100644 index 0000000..d95f7db --- /dev/null +++ b/templates/album.hamlet @@ -0,0 +1,16 @@ +$newline never +

#{albumTitle album} +by #{ownerName} +
+ $if presence == True + TODO: direct Upload to this album +
+ $if null media + This album is empty + $else + Images in this album: + $forall (medium) <- media +
+ +
+ #{mediumTitle medium}