[extensions-web] ratings: Add back ratings to comments



commit 8c17c72c3e67aa7dcb0921b8848f6dcf8a8fe67d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Mar 18 00:24:10 2013 -0400

    ratings: Add back ratings to comments
    
    Whoops!

 sweettooth/ratings/views.py                        |   20 ++++++++++++--------
 sweettooth/static/css/sweettooth.css               |    2 +-
 .../js/templates/extensions/comment.mustache       |    4 ++--
 sweettooth/static/js/templates/templatedata.js     |    2 +-
 4 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/sweettooth/ratings/views.py b/sweettooth/ratings/views.py
index 263ea15..6a4e394 100644
--- a/sweettooth/ratings/views.py
+++ b/sweettooth/ratings/views.py
@@ -22,14 +22,18 @@ def comment_details(request, comment):
     gravatar = gravatar_url(request, comment.email)
     is_extension_creator = (comment.user == extension.creator)
 
-    return dict(gravatar = gravatar,
-                is_extension_creator = is_extension_creator,
-                rating = comment.rating,
-                comment = comment.comment,
-                author = dict(username=comment.user.username,
-                              url=reverse('auth-profile', kwargs=dict(user=comment.user.username))),
-                date = dict(timestamp = comment.submit_date.isoformat(),
-                            standard = format_date(comment.submit_date, 'F j, Y')))
+    details = dict(gravatar = gravatar,
+                   is_extension_creator = is_extension_creator,
+                   comment = comment.comment,
+                   author = dict(username=comment.user.username,
+                                 url=reverse('auth-profile', kwargs=dict(user=comment.user.username))),
+                   date = dict(timestamp = comment.submit_date.isoformat(),
+                               standard = format_date(comment.submit_date, 'F j, Y')))
+
+    if comment.rating > -1:
+        details['rating'] = comment.rating
+
+    return details
 
 @ajax_view
 def get_comments(request):
diff --git a/sweettooth/static/css/sweettooth.css b/sweettooth/static/css/sweettooth.css
index 99c8de2..230c176 100644
--- a/sweettooth/static/css/sweettooth.css
+++ b/sweettooth/static/css/sweettooth.css
@@ -1047,7 +1047,7 @@ li.extension:last-child {
 
 .comment .rating {
     margin-right: 6px;
-    float: left;
+    float: right;
 }
 
 .comment .comment-author {
diff --git a/sweettooth/static/js/templates/extensions/comment.mustache 
b/sweettooth/static/js/templates/extensions/comment.mustache
index d4a61db..8fcb7b4 100644
--- a/sweettooth/static/js/templates/extensions/comment.mustache
+++ b/sweettooth/static/js/templates/extensions/comment.mustache
@@ -4,9 +4,9 @@
   {{/is_extension_creator}}
   <img src="{{gravatar}}" class="gravatar">
   <div class="rating-author">
-    {{#has_rating}}
+    {{#rating}}
       <div class="rating" data-rating-value="{{rating}}"></div> by
-    {{/has_rating}}
+    {{/rating}}
     <a class="comment-author" href="{{author.url}}">{{author.username}}</a>
     <p>{{comment}}</p>
     <time datetime="{{date.timestamp}}Z">{{date.standard}}</time>
diff --git a/sweettooth/static/js/templates/templatedata.js b/sweettooth/static/js/templates/templatedata.js
index c55cf3d..64e7f62 100644
--- a/sweettooth/static/js/templates/templatedata.js
+++ b/sweettooth/static/js/templates/templatedata.js
@@ -2,7 +2,7 @@
 "use strict";
 
 define({
-  "extensions/comment": "<div class=\"comment\">\n  {{#is_extension_creator}}\n  <div 
class=\"extension-creator-badge\">Author</div>\n  {{/is_extension_creator}}\n  <img src=\"{{gravatar}}\" 
class=\"gravatar\">\n  <div class=\"rating-author\">\n    {{#has_rating}}\n      <div class=\"rating\" 
data-rating-value=\"{{rating}}\"></div> by\n    {{/has_rating}}\n    <a class=\"comment-author\" 
href=\"{{author.url}}\">{{author.username}}</a>\n    <p>{{comment}}</p>\n    <time 
datetime=\"{{date.timestamp}}Z\">{{date.standard}}</time>\n  </div>\n</div>",
+  "extensions/comment": "<div class=\"comment\">\n  {{#is_extension_creator}}\n  <div 
class=\"extension-creator-badge\">Author</div>\n  {{/is_extension_creator}}\n  <img src=\"{{gravatar}}\" 
class=\"gravatar\">\n  <div class=\"rating-author\">\n    {{#rating}}\n      <div class=\"rating\" 
data-rating-value=\"{{rating}}\"></div> by\n    {{/rating}}\n    <a class=\"comment-author\" 
href=\"{{author.url}}\">{{author.username}}</a>\n    <p>{{comment}}</p>\n    <time 
datetime=\"{{date.timestamp}}Z\">{{date.standard}}</time>\n  </div>\n</div>",
   "extensions/comments_list": "{{#comments}}\n  {{>extensions/comment}}\n  
<hr>\n{{/comments}}\n{{^show_all}}\n<p class=\"show-all\">Show more 
reviews</p>\n{{/show_all}}\n\n{{^comments}}\n  <p>There are no comments. Be the first!</p>\n{{/comments}}",
   "extensions/error_report_template": "What's wrong?\n\n\n\nWhat have you tried?\n\n\n\nAutomatically 
detected errors:\n\n{{#errors}}\n  {{.}}\n\n================\n{{/errors}}\n{{^errors}}\nGNOME Shell 
Extensions did not detect any errors with this extension.\n{{/errors}}\n\nVersion information:\n\n    Shell 
version: {{sv}}\n    Extension version: {{#ev}}{{ev}}{{/ev}}{{^ev}}Unknown{{/ev}}",
   "extensions/info": "<div class=\"extension\" data-uuid=\"{{uuid}}\">\n  
{{>extensions/info_contents}}\n</div>",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]