This page last changed on May 29, 2012 by jed.wheeler@involver.com.


General Considerations

This tag allows for the user to rate an item on a 5-star scale. A user's rating is only recorded once and any changes to his or her rating will overwrite the old rating.


Caching Considerations

The average rating may not reflect the latest ratings during times of high load.  Because of the Caching system used to maintain page performance, ratings should be accurate to within 10 minutes.

Because of the relatively large amount of data we need to push to create the rating system functionality (it requires over-writable values that allows us to track who has rated each item, what value each user gave each item, and also generate and update an average rating with each entry) this functionality cannot be used with more then 300 items at any given time.  This restriction means we cannot enable rating as a sorting criteria on the paginate helper block since there's no way to restrict the total number of items paginate sorts.  Instead, we recomend using the sort_by attribute on the for loop.


Attributes

name type required description
rate_image string no URL of the ratings image
star_size integer no Square pixel size of each rating image
callback string
no JS function to fire after a user has successfully voted. The rating value (1-5) is passed as a parameter. 
show_average string no Highlight the current average rating if the user hasn't already rated. If the user has, the user's rating will be highlighted.

Examples

<h2>Tweets from Involver, Follow us<br>
@<a href="http://www.twitter.com/involver">Involver</a></h2>

{% twitter_feed %}
    {% paginate twitter_feed.tweets per_page:5 %}
        {% for story in tweets %}
        <div class="tweet">
            <h3>{{ story.title | twitter_link | auto_link }}</h3>
            <p>{{ story.published_relative_time }} - {% rate story %}</p>
        </div>
        {% endfor %}
    {% endpaginate %}
{% endtwitter_feed %}

Rate Image

The rate image should contain three square icons stacked vertically ordered from the top as not selected, selected, hover. The default size for each icon is 16x16px. If another size is needed, please provide it as an attribute for the tag.

Example:
Cannot resolve external resource into attachment.


Access Rating Information

Every content item has the following attributes to retrieve rating information

name type description
*content_item.*rating string String value of the average total rating for the item. (Ex. "4.35")
*content_item.*rating_count integer Total number of people who have rated this item.
Document generated by Confluence on Feb 12, 2013 09:09