Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ratings for radiant pages
Ruby JavaScript
branch: master

This branch is 1 commit behind mikehale:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
autotest
db
lib
public
spec
LICENSE
README.rdoc
Rakefile
ratings_extension.rb

README.rdoc

Ratings

Allows your users to rate pages. Features:

  • Easy installation and uninstallation (single rake task to do both).

  • Provides the CSS, images and javascript for a user-friendly star-rating system.

  • Uses unobtrusive javascript.

  • Works without javascript.

Installation

$ cd <radiant_app>/vendor/extensions/
$ git clone git://github.com/myronmarston/radiant-ratings-extension.git ratings
$ cd ../..
$ rake radiant:extensions:ratings:install

This will:

  • Copy the code into the proper location.

  • Migrate your database.

  • Copy some public assets (image, javascript and css files) into your app.

  • Create the necessary snippets and config records in the database.

Uninstallation

$ rake radiant:extensions:ratings:uninstall
$ rm -rf vendor/extensions/ratings

Usage

This extension provides the assets (images, javascript and css) for a user-friendly ajax star-rating system. To use them, you'll need to include them in the <head> section of your layout:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<r:snippet name="rating_asset_includes" />

Add the rating snippet to any pages you want rated, or to a common layout:

<r:snippet name="rating" />

Additional customization

If you use an image with a different size or more or less padding, you'll want to update the config settings appropriately:

Radiant::Config['ratings.image_width'] = 15
Radiant::Config['ratings.image_padding'] = 3

These are needed so the background image width can be calculated properly based on the rating average.

In your snippet, you can also display different options depending on the point value and the page rating:

<r:points:each>
  <r:if_average_greater>
    <input type="image" src="/images/red_star.png" name="rating" value="<r:point_value />" />
  </r:if_average_greater>
  <r:if_average_less>
    <input type="image" src="/images/grey_star.png" name="rating" value="<r:point_value />" />
  </r:if_average_less>
</r:points:each>

Home

github.com/myronmarston/radiant-ratings-extension/tree/master

Credits

Originally sponsored by Ignite Social Media LLC - ignitesocialmedia.com/

Further development by:

The star rating assets are a modified version of the star rating system found on komodo media.

See LICENSE for copyright and licensing details.

Something went wrong with that request. Please try again.