From cc6d60e08dcf72466062183335f17f9e4698a218 Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 18 Aug 2014 03:09:37 +0200 Subject: [PATCH] album site --- Handler/Album.hs | 19 +++++++++++++++++++ templates/album.hamlet | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Handler/Album.hs create mode 100644 templates/album.hamlet 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 +