Portability | unportable |
---|---|
Stability | unstable |
Maintainer | pbrisbin@gmail.com |
- data Comment = Comment {}
- data CommentForm = CommentForm {
- formUser :: Text
- formEmail :: Text
- formComment :: Markdown
- formIsAuth :: Bool
- type CommentId = Int
- type ThreadId = Text
- class Yesod m => YesodComments m where
- getComment :: ThreadId -> CommentId -> GHandler s m (Maybe Comment)
- storeComment :: Comment -> GHandler s m ()
- deleteComment :: Comment -> GHandler s m ()
- loadComments :: Maybe ThreadId -> GHandler s m [Comment]
- getNextCommentId :: [Comment] -> GHandler s m CommentId
- commentFilters :: [Comment -> GHandler s m Bool]
- displayUser :: AuthId m -> GHandler s m Text
- displayEmail :: AuthId m -> GHandler s m Text
- commentFromForm :: ThreadId -> CommentId -> CommentForm -> GHandler s m Comment
- commentForm :: GFormMonad s m (FormResult CommentForm, GWidget s m ())
- commentFormAuth :: Text -> Text -> Text -> GFormMonad s m (FormResult CommentForm, GWidget s m ())
- showComment :: Yesod m => Comment -> GWidget s m ()
- showCommentAuth :: (Yesod m, YesodAuth m, YesodComments m) => Comment -> GWidget s m ()
Documentation
data CommentForm Source
CommentForm | |
|
class Yesod m => YesodComments m whereSource
getComment :: ThreadId -> CommentId -> GHandler s m (Maybe Comment)Source
storeComment :: Comment -> GHandler s m ()Source
deleteComment :: Comment -> GHandler s m ()Source
loadComments :: Maybe ThreadId -> GHandler s m [Comment]Source
Loading all comments, possibly filtered to a single thread.
getNextCommentId :: [Comment] -> GHandler s m CommentIdSource
Get the next available Id given the passed list of comments. In Handler in case there is a database call involved.
commentFilters :: [Comment -> GHandler s m Bool]Source
displayUser :: AuthId m -> GHandler s m TextSource
if using Auth, provide the function to get from a user id to
the string to use as the commenter's username. This should
return something friendlier than just a conversion to String
displayEmail :: AuthId m -> GHandler s m TextSource
if using Auth, provide the function to get form a user id to the string to use as the commenter's email.
commentFromForm :: ThreadId -> CommentId -> CommentForm -> GHandler s m CommentSource
Cleanse form input and create a Comment
to be stored
commentForm :: GFormMonad s m (FormResult CommentForm, GWidget s m ())Source
The comment form itself
:: Text | text version of uid |
-> Text | friendly name |
-> Text | |
-> GFormMonad s m (FormResult CommentForm, GWidget s m ()) |
The comment form if using authentication (uid is hidden and display name is shown)
showCommentAuth :: (Yesod m, YesodAuth m, YesodComments m) => Comment -> GWidget s m ()Source
Show a single comment, auth version