EasyComments

Gem Version

EasyComments(EC) is an easy to use comment system with a simple api for posting and retrieving comments.It also comes bundled with a dashboard for moderating your comments.

Installing

Install by cloning the repository or for convenience install the gem

gem install easycomments

and then(if you installed the gem) in a directory run

ec install

(pass the --dev flag if you also want the spec suite)
Then

bundle install

and you are ready.

Configuring

Edit _config.yml and add your database (all adapters supported by sequel can be used) and change any other option you need. Then run

rake init

to build the table and then

rake adduser

to add your user.

Endpoints

EC has one endpoint for posting a new comment and one for retrieving a comment list.

GET /comments, with a 'post' parameter 

The 'post' parameter simply serves as a namespace to group comments for retrieval, it can be a blog post title, an url or something more sophisticated, it's up to you.

POST /comment, with parameters : post, name, email, body

Example client can be found here : easycomments-polymer

Dashboard

EC comes bundled with a dashboard (can be accessed at /dashboard) to moderate your comments like approving, deleting, editing or ignoring. It's build with polymer and webcomponents

Configuration options

in _config.yml you can change the following

#database connection url to be passed to sequel's connect method.
#check http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html
#all adapters supported by sequel can be used
connection: "sqlite://blog.db"

#set to true to allow all coments to be posted without moderation.
approve_by_default: false

#set to true to allow comments without a name.
allow_anonymous_post: false

#datetime format to be passed to strftime.
#see availabe options here http://ruby-doc.org/core-2.2.1/Time.html#method-i-strftime
timestamp_format: "%d/%m/%Y - %H:%M"

#set to true to enable cross-origin resource sharing.
allow_cors: false

#see available formats here https://github.com/cyu/rack-cors
cors_origin: "*"  

#set to false to not automatically escape html in comment bodys  
auto_escape_html: true

Updating

If you installed easycomments as a gem there is a 'ec update' command. It will recopy all the files but keeps your _config.yml and Gemfile.
(--dev flag is available to also copy the spec suite)

Rake tasks

'rake init' creates the required table.
'rake update' run it after re-editing _config.yml to update the table.
'rake adduser' you should always run this and not adding new users in _config.yml
by hand since it also bcypts your passwords!

TODO:

  • pagination in GET /comments
  • markdown support
  • dynamic fields in POST /comment

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Licensed under MIT.