%
current_rating = @resource.current_rating( current_user )
if current_user
current_rating_string = ( current_rating ? "You rated this a #{current_rating}" : "Rate this resource" )
instruction = "(Click stars to rate)"
else
current_rating_string = 'Login to rate resource'
instruction = " "
end
%>
<% if current_user %>
-
<%= current_rating_string -%>
<% for stars in 1..5 %>
-
<%= link_to stars.to_s, { :controller => 'rating', :action => (current_rating ? 'update' : 'create'),
:rateable_id => @resource.id, :user_id => (current_user.nil? ? nil : current_user.id),
:rating => stars },
{ :title => "#{pluralize(stars, 'star')} out of 5",
:class => "stars-#{stars}" } %>
<% end %>
<% else %>
- <%= current_rating_string -%>
<% end %>
<%= current_rating_string -%>
<%= instruction -%>