Permalink
Browse files

added Ajax.Responders.register onComplete to parse new rating div aft…

…er ajax calls
  • Loading branch information...
1 parent 042552e commit f9928c853fd248c3c6a7caf14114dee9b7ec4008 @pilu committed May 5, 2008
Showing with 14 additions and 3 deletions.
  1. +14 −3 javascripts/rating.js
View
@@ -167,19 +167,30 @@ var Ratable = Class.create({
});
-var Rating = Class.create({
+r Rating = Class.create({
initialize: function(class_name) {
this.class_name = class_name;
this.options = Object.extend({
afterRate: Prototype.emptyFunction
}, arguments[1] || {});
- this.setup();
+ this.elements = new Array();
+ this.setup();
},
setup: function() {
+ Ajax.Responders.register({
+ onComplete: this.parse.bind(this)
+ });
+ this.parse();
+ },
+
+ parse: function() {
$$('.' + this.class_name).each(function(element) {
- new Ratable(element, this.options);
+ if(!this.elements.include(element)) {
+ this.elements.push(element);
+ new Ratable(element, this.options);
+ }
}.bind(this));
}

0 comments on commit f9928c8

Please sign in to comment.