<title> Memories - Photo Sharing [% IF photo %] - [% photo.title; END%]</title>
<meta name="robots" content="nofollow">
<link title="Maypole" href="[%base%]/static/memories.css" type="text/css" rel="stylesheet"/>
+ <link href="[%base%]/static/star_rating.css" type="text/css" rel="stylesheet"/>
[% IF photos %]
<link rel="alternate" type="application/rdf+xml" title="RSS"
href="[%base%]/[%path%]?format=rss" />
+<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>
+ ([%photo.approx_rating%] out of [%photo.rated%] votes)
+</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>
<div class="comments">
[% FOR comment = photo.comments %]
<div class="comment">
</div>
[% END %]
<div class="comment">
- <form action="[%base%]/photo/add_comment/[%photo.id%]" method="post">
- Name: <input name="name" /> <hr>
- <textarea name="content" cols="60" rows="5"/>
- </textarea>
+ <form action="javascript:post_comment()" method="post">
+ Name: <input id="commentname" name="name" /> <hr>
+ <textarea id="newcomment" name="content" cols="60" rows="5"/></textarea>
<p>
<input type="submit" name="Comment on this picture" value="Comment on this picture">
</p>
--- /dev/null
+.star-rating,
+.star-rating a:hover,\r
+.star-rating a:active,\r
+.star-rating a:focus,
+.star-rating .current-rating{
+ background: url(star.gif) left -1000px repeat-x;
+}
+.star-rating{\r
+ position:relative;\r
+ width:125px;\r
+ height:25px;\r
+ overflow:hidden;\r
+ list-style:none;\r
+ margin:0;\r
+ padding:0;\r
+ background-position: left top;\r
+}\r
+.star-rating li{
+ display: inline;\r
+}\r
+.star-rating a,
+.star-rating .current-rating{\r
+ position:absolute;\r
+ top:0;\r
+ left:0;\r
+ text-indent:-1000em;\r
+ height:25px;\r
+ line-height:25px;\r
+ outline:none;\r
+ overflow:hidden;
+ border: none;
+}
+.star-rating a:hover,\r
+.star-rating a:active,\r
+.star-rating a:focus{
+ background-position: left bottom;
+}\r
+.star-rating a.one-star{\r
+ width:20%;\r
+ z-index:6;\r
+}\r
+.star-rating a.two-stars{\r
+ width:40%;\r
+ z-index:5;\r
+}\r
+.star-rating a.three-stars{\r
+ width:60%;\r
+ z-index:4;\r
+}\r
+.star-rating a.four-stars{\r
+ width:80%;\r
+ z-index:3;\r
+}\r
+.star-rating a.five-stars{\r
+ width:100%;\r
+ z-index:2;\r
+}\r
+.star-rating .current-rating{\r
+ z-index:1;\r
+ background-position: left center;
+} \r
+\r
+/* for an inline rater */\r
+.inline-rating{\r
+ display:-moz-inline-block;\r
+ display:-moz-inline-box;\r
+ display:inline-block;\r
+ vertical-align: middle;\r
+}\r
+\r
+/* smaller star */\r
+.small-star{\r
+ width:50px;\r
+ height:10px;\r
+}
+.small-star,
+.small-star a:hover,\r
+.small-star a:active,\r
+.small-star a:focus,
+.small-star .current-rating{
+ background-image: url(star_small.gif);
+ line-height: 10px;
+ height: 10px;
+}\r\r\r\r