{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} ------------------------------------------------------------------------------- -- | -- Module : Yesod.Comments -- Copyright : (c) Patrick Brisbin 2010 -- License : as-is -- Maintainer : pbrisbin@gmail.com -- Stability : unstable -- Portability : unportable -- -- A generic Comments interface for a Yesod application. This module is -- in the early stages of development. Beware bugs, patches welcome. -- ------------------------------------------------------------------------------- module Yesod.Comments ( addComments , addCommentsAuth , module Yesod.Comments.Core ) where import Yesod import Yesod.Comments.Core import Yesod.Comments.Filters (applyFilters) import Yesod.Helpers.Auth -- | Comments that anyone can enter anonymously addComments :: YesodComments m => ThreadId -- ^ the thread you're adding comments to -> GWidget s m () addComments tid = do comments <- lift $ loadComments (Just tid) cid <- lift $ getNextCommentId comments ((res, form), enctype) <- lift $ runFormMonadPost commentForm handleForm res tid cid addStyling [hamlet|