[extensions-web] js: Apply ratings on the new fancy comments



commit a51cd2f71e0ad00bfeb8ca61f044a14ae7dae377
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Oct 19 14:34:49 2012 -0400

    js: Apply ratings on the new fancy comments

 sweettooth/static/js/main.js |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/sweettooth/static/js/main.js b/sweettooth/static/js/main.js
index 2afb0ee..43589c5 100644
--- a/sweettooth/static/js/main.js
+++ b/sweettooth/static/js/main.js
@@ -77,12 +77,16 @@ function($, messages, modal, hashParamUtils, templates) {
             size: 25
         });
 
-        $('.comment .rating').each(function() {
-            $(this).raty({
-                start: $(this).data('rating-value'),
-                readOnly: true
+        $.fn.ratify = function() {
+            return this.each(function() {
+                $(this).raty({
+                    start: $(this).data('rating-value'),
+                    readOnly: true
+                });
             });
-        });
+        };
+
+        $('.comment .rating').ratify();
         $('#rating_form').hide();
         $('#rating_form .rating').raty({ scoreName: 'rating' });
 
@@ -184,6 +188,7 @@ function($, messages, modal, hashParamUtils, templates) {
                     $newContent.addClass('comments-holder');
 
                     $newContent.find('time').timeago();
+                    $newContent.find('.rating').ratify();
                     $newContent.find('.show-all').on('click', function() {
                         $(this).addClass('loading');
                         fetchComments(base, true);



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