Skip to content
Browse files

remove non-functioning test, update readme

  • Loading branch information...
1 parent 4847056 commit 148eb36e98d484e36210fb490d39d3d0a681a147 @pbrisbin committed Jan 24, 2012
Showing with 59 additions and 85 deletions.
  1. +59 −2 README.md
  2. +0 −7 TODO.md
  3. +0 −76 Test.hs
View
61 README.md
@@ -1,6 +1,6 @@
# Yesod Comments
-### Description
+## Description
A drop-in comments module for a Yesod application with a focus on
flexibility and simplicity.
@@ -10,9 +10,66 @@ Now available on
### Usage
-See ./Test.hs or read the [haddocks][].
+See the [haddocks][].
Also, check out my [landlord][] project to see it in use.
[haddocks]: http://pbrisbin.com/haskell/docs/html/yesod-comments "yesod comments haddocks"
[landlord]: http://rentersreality.com "review landlords at renters' reality"
+
+### Styling
+
+By default there is no styling, but there are (hopefully) useful classes
+on all the involved divs.
+
+The forms themselves are somewhat catered towards Twitter's bootstrap.
+If you use that on your site, things should look decent out of the box.
+
+The following additional styling works pretty well for me:
+
+~~~ { .css }
+.yesod_comments {
+ width: 500px;
+ margin-left: 25px;
+}
+.yesod_comments .avatar {
+ float: left;
+ height: 48px;
+ width: 48px;
+ margin-right: 12px;
+}
+.yesod_comments .list .avatar {
+ margin: 0px;
+ margin-right: 5px;
+ height: 20px;
+ width: 20px;
+
+ vertical-align: middle;
+}
+.yesod_comments .list .attribution a,
+.yesod_comments .list .attribution p {
+ font-size: 95%;
+}
+.yesod_comments .list .attribution p {
+ color: #999;
+}
+.yesod_comments .list .comment {
+ padding: 5px;
+ margin-bottom: 20px;
+ border: solid 1px #eee;
+}
+.yesod_comments .list .comment .content {
+ padding: 0px;
+ margin: 20px 5px;
+}
+.yesod_comments .input form .clearfix {
+ margin-left: 60px;
+}
+.yesod_comments .input textarea {
+ height: 180px;
+ width: 400px;
+}
+.form-stacked .clearfix {
+ margin-bottom: 0px;
+}
+~~~
View
7 TODO.md
@@ -1,7 +0,0 @@
-Before I will use this on my own site...
-
-* Enable the use of `blacklist`
-* Create some sort of moderation page (edit/delete actions on existing
- comments)
-* Threading / in-reply-to? Yeah right...
-* Import existing comments from disqus xml
View
76 Test.hs
@@ -1,76 +0,0 @@
-{-# LANGUAGE QuasiQuotes #-}
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE TypeFamilies #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
---
--- pbrisbin 2010
---
--- How to use Yesod.Comments
---
-module Test where
-
-import Yesod.Comments
-import Yesod.Comments.Storage
-import Yesod.Comments.Filters (blacklistFile)
-
-import Yesod
-import Network.Wai.Handler.Warp (run)
-import Database.Persist.Sqlite
-import Database.Persist.GenericSql
-import Text.Blaze (toHtml)
-
-data CommentTest = CommentTest { connPool :: ConnectionPool }
-type Handler = GHandler CommentTest CommentTest
-type Widget = GWidget CommentTest CommentTest
-
-mkYesod "CommentTest" [parseRoutes|
- / RootR GET POST
- |]
-
-instance Yesod CommentTest where approot _ = ""
-
-instance YesodPersist CommentTest where
- type YesodDB CommentTest = SqlPersist
- runDB db = liftIOHandler $ fmap connPool getYesod >>= runSqlPool db
-
-withConnectionPool :: MonadControlIO m => (ConnectionPool -> m a) -> m a
-withConnectionPool = withSqlitePool "comments.db3" 10
-
-instance YesodComments CommentTest where
- getComment = getCommentPersist
- storeComment = storeCommentPersist
- deleteComment = deleteCommentPersist
- loadComments = loadCommentsPersist
- --commentFilters = [blacklistFile "blacklist.txt"]
-
-getRootR :: Handler RepHtml
-getRootR = defaultLayout $ do
- setTitle "comments test page"
-
- -- i hope he doesn't mind...
- addHamletHead [hamlet|
- <link href="http://johnmacfarlane.net/css/hk-pyg.css" rel="stylesheet" media="screen" type="text/css">
- |]
-
- addHamlet [hamlet|
- <h1>Test Page
- <p>Welcome to my comments test page.
- <h3>Comments
- |]
- addComments "test"
-
-postRootR :: Handler RepHtml
-postRootR = getRootR
-
-main :: IO ()
-main = putStrLn "Loaded" >> withCommentTest (run 3000)
-
-withCommentTest :: (Application -> IO a) -> IO a
-withCommentTest f = withConnectionPool $ \p -> do
- -- | make sure you run the migration to create the necessary tables,
- -- "Yesod.Comments.Storage" exports 'migrateComments' for this
- -- purpose.
- runSqlPool (runMigration migrateComments) p
- let h = CommentTest p
- toWaiApp h >>= f

0 comments on commit 148eb36

Please sign in to comment.
Something went wrong with that request. Please try again.