Skip to content
Extraits de code Groupes Projets
Valider c1c622ff rédigé par Maxwell Salzberg & Sarah Mei's avatar Maxwell Salzberg & Sarah Mei
Parcourir les fichiers

Viewing more comments rebinds javascript

parent a7d05756
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
this.subscribe("widget/ready", function(evt, commentStream) { this.subscribe("widget/ready", function(evt, commentStream) {
$.extend(self, { $.extend(self, {
commentStream: commentStream, commentStream: commentStream,
commentToggle: commentStream.siblings(".show_comments").find(".toggle_post_comments") commentToggle: commentStream.siblings(".show_comments").find(".toggle_post_comments"),
postGuid: commentStream.parents(".stream_element").first().attr("id")
}); });
self.commentToggle.toggle(self.showComments, self.hideComments); self.commentToggle.toggle(self.showComments, self.hideComments);
...@@ -25,8 +26,7 @@ ...@@ -25,8 +26,7 @@
self.commentToggle.html(Diaspora.I18n.t("comments.hide")); self.commentToggle.html(Diaspora.I18n.t("comments.hide"));
self.commentStream.html(data) self.commentStream.html(data)
.addClass("loaded"); .addClass("loaded");
self.globalPublish("commentStream/" + self.postGuid + "/loaded");
self.globalPublish("commentStream/" + self.commentStream.attr("id") + "/loaded");
}); });
} }
}; };
......
(function() { (function() {
var StreamElement = function() { var StreamElement = function() {
var self = this; var self = this;
this.subscribe("widget/ready", function(evt, element) { this.subscribe("widget/ready", function(evt, element) {
self.postGuid = element.attr("id"); self.postGuid = element.attr("id");
...@@ -15,8 +15,11 @@ ...@@ -15,8 +15,11 @@
}); });
self.globalSubscribe("post/" + self.postGuid + "/comment/added", function(evt, comment) { self.globalSubscribe("post/" + self.postGuid + "/comment/added", function(evt, comment) {
self.commentStream.publish("comment/added", comment); self.commentStream.publish("comment/added", comment);
}); });
self.globalSubscribe("commentStream/" + self.postGuid + "/loaded", function(evt) {
self.commentStream.instantiateCommentWidgets();
});
}); });
}; };
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter