{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ScopedTypeVariables #-} module Handler.Timeline where import Import -- TODO: Bearbeiten Sie die Aufgaben im Widget-Template "timeline" getTimelineR :: Handler Html getTimelineR = do (uid, user) <- requireAuthPair posts <- runDB $ selectList [PostUserId ==. uid] [Desc PostCreated] (postWidget, postEnctype) <- generateFormPost (postForm Nothing uid) let userName :: Text userName = userIdent user defaultLayout $ do setTitle . toHtml $ userName <> "'s Timeline" $(widgetFile "timeline") -- TODO: Implementieren Sie ein Verhalten zum Speichern des Posts. -- Nützliche Funktionen: runFormPost. postTimelineR :: Handler Html postTimelineR = do getTimelineR postForm :: Maybe PostId -> UserId -> Form Post postForm p u = renderDivs $ Post <$> pure u <*> areq textField "Post" (Just "Post content") <*> pure p <*> lift (liftIO getCurrentTime)