Skip to content
Extraits de code Groupes Projets
Valider 2c4a75f6 rédigé par Michael Sofaer's avatar Michael Sofaer Validation de Michael Sofaer & Raphael Sofaer
Parcourir les fichiers

Handle multiple notification objects correctly

parent d6ba3c97
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -13,3 +13,4 @@ ...@@ -13,3 +13,4 @@
= link_to("", "#", :class => "object") = link_to("", "#", :class => "object")
%br %br
%time
...@@ -42,20 +42,31 @@ ...@@ -42,20 +42,31 @@
"success":function(data){ "success":function(data){
$("#notifications_overlay").show(); $("#notifications_overlay").show();
var hash = eval("(" + data + ")"); var hash = eval("(" + data + ")");
var notifications_element = $("#notifications_overlay .notifications");
var day_element_template = $("#notifications_overlay .day_group").clone();
day_element_template.find(".notifications_for_day").empty();
var stream_element_template = $("#notifications_overlay .stream_element").clone();
notifications_element.empty();
$.each(hash["group_days"], function(day){ $.each(hash["group_days"], function(day){
$("#notifications_overlay .month").text(day.split(" ")[0]) var day_element = day_element_template.clone();
$("#notifications_overlay .day").text(day.split(" ")[1]) day_element.find(".month").text(day.split(" ")[0])
day_element.find(".day").text(day.split(" ")[1])
var notifications_for_day = hash["group_days"][day] var notifications_for_day = hash["group_days"][day]
console.log(notifications_for_day); var notifications_for_day_element = day_element.find('.notifications_for_day');
$.each(notifications_for_day, function(i, notification_hash){ $.each(notifications_for_day, function(i, notification_hash){
$.each(notification_hash, function(notification_type, notification){ $.each(notification_hash, function(notification_type, notification){
var stream_element = stream_element_template.clone();
console.log(notification_type); console.log(notification_type);
console.log(notification); console.log(notification);
$("#notifications_overlay .actor"). stream_element.find(".actor").
text(notification["actors"][0]["name"]). text(notification["actors"][0]["name"]).
attr("href", notification["actors"][0]["url"]); attr("href", notification["actors"][0]["url"]);
console.log(notification["created_at"]);
stream_element.find('time').text(notification["created_at"]);
notifications_for_day_element.append(stream_element);
}); });
}); });
notifications_element.append(day_element);
}) })
} }
}); });
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter