Skip to content

myronmarston/radiant-ratings-extension

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Ratings for radiant pages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 95.9%
  • JavaScript 4.1%