+<p style="background:#fff">Rate this photo!
+<span class="inline-rating">
+<ul class="star-rating">
+ [% IF photo.approx_rating %]
+ <li class='current-rating' style="width:[% photo.approx_rating * 25 %]px">Currently [%photo.approx_rating%]/5 Stars.</li>
+ [% END %]
+ <li><a href='javascript:add_rating(1)' title='1 star out of 5' class='one-star'>1</a></li>
+ <li><a href='javascript:add_rating(2)' title='2 stars out of 5' class='two-stars'>2</a></li>
+ <li><a href='javascript:add_rating(3)' title='3 stars out of 5' class='three-stars'>3</a></li>
+ <li><a href='javascript:add_rating(4)' title='4 stars out of 5' class='four-stars'>4</a></li>
+ <li><a href='javascript:add_rating(5)' title='5 stars out of 5' class='five-stars'>5</a></li>
+ </ul>
+</span>
+ [% IF photo.rated > 0%]
+ ([%photo.approx_rating%] out of [%photo.rated%] votes)
+ [% END %]
+</p>
+<script>
+add_rating = function (rank) {
+ new Ajax.Request("[%base%]/photo/add_rating/[%photo.id%]",
+ { method: "get", parameters: {rating: rank },
+ onSuccess: function () {
+ new Ajax.Updater("content", "[%base%]/photo/comment/[%photo.id%]")
+ }
+ });
+ add_rating = function (rank) { alert("You've already rated this photo") }
+}
+
+
+function post_comment () {
+ new Ajax.Request("[%base%]/photo/add_comment/[%photo.id%]",
+ { method: "post",
+ parameters: { name: $("commentname").value,
+ content: $("newcomment").value
+ },
+ onSuccess: function () {
+ new Ajax.Updater("content", "[%base%]/photo/comment/[%photo.id%]")
+ }
+ });
+}
+</script>