Agile Web Development

Build it. Launch it. Love it.

Restful Comments

Provides complete comment system, which can be easily integrated into existing application. Comments may be customized with different stylesheets, user access rules. Plugin supports localization using Globalite plugin. Transparently integrates with Restful Citations plugin.

Features

  • Easy integration
  • Textilize markup in comments
  • Globalite localization
  • Customizing stylesheets
  • Customizing access policy

Requirements

This plugin requires the following plugins installed:

If your Rails version prior to 1.2:

Installation

script/install svn://rubyforge.org/var/svn/rf-comments/trunk/restful_comments script/generate plugin_migration

Usage

Common configuring:

  1. Add map.from_plugin :restful_comments to your routes.rb
  2. Copy localization files from {RAILS_ROOT}/vendor/plugins/restful_comments/lang/ui directory to your {RAILS_ROOT}/lang/ui directory, or add their content to your existing localization files
  3. In environment.rb set your localization language (for example, Globalite.language = :en)
  4. If you want to specify per-user access rules and your helpers haven’t method current_user, implement this method in ApplicationHelper.

For commentable models:

  1. Add acts_as_restful_commentable into your model class to declare it as commentable
  2. Add <%= restful_comments_include %> into your erb template to include styles and javascripts
  3. Don’t forget to add <%= javascript_include_tag :defaults %> to your layout
  4. Add <%= restful_comments_for {model_instance} %> into view to render comments of {model_instance}

Configuring access

You can specify access rules for different commentable models. To do it, you need to specify block in acts_as_restful_commentable call.

This block can contain some of methods:

        def can_comment?( commentable, comment, user )

        def can_edit?( commentable, comment, user )

        def can_remove?( commentable, comment, user )

Each method returns if user can make coresponding action on comment. If user comments a commentable, it will be checked with method can_comment?( commentable, nil, user ), if user replyes on specific comment, it will be checked with can_comment?( commentable, comment, user )

If you want to specify user-dependent access, when user must be accessible through current_user method in helper

Configuring styles

To configure display of editor you may pass hash of options to restful_citations_include. Available options:

  • :style - name of built-in style. Available value: ‘gray’, ‘lj’
  • :stylesheet - name of application stylesheet to use

Vitals

Home http://rubyforge.org/projects/rf-comments/
Repository http://rf-comments.rubyforge.org/svn/trunk/restful_comments/
License Rails' (MIT)
Tags Tag_red acts_as_commentable comments engines REST
Rating (8 votes)
Owner Alexey Noskov
Created 19 August 2007

Comments

  • Avatar
    Lenart
    3 January 2008

    Has anyone managed to get this working with Rails 2.0?

  • Avatar
    Lenart
    7 January 2008

    I'm not sure I like the idea of this plugin being dependent on Globalite plugin. What do you do when you want to use some other translation engine?

  • Avatar
    Dan
    7 February 2008

    I just started on this about an hour ago, but i keep getting odd errors. There doesn't seem to be much else on the web in the way of support for this plugin.

  • Avatar
    21 October 2008

    I also notice these bizarre errors (stack full, spected user and geted user) and, thanks to you, I proceed like you:

    I just remove engines plugin, and move “restful_comments/apps” contents to root/apps. I also move assets(javascript and styles) to public folder and add to “routes.rb” the map.resource :comments line

    Now thats’fine

    Cristian

Add a comment