From cba7a1a577cc0ddd824e179e4ce412e9004f4939 Mon Sep 17 00:00:00 2001 From: Dan Hansen & Michael Sofaer Date: Mon, 20 Jun 2011 18:35:00 -0700 Subject: [PATCH] timeago for ajax notifications --- public/javascripts/widgets/notifications-badge.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/public/javascripts/widgets/notifications-badge.js b/public/javascripts/widgets/notifications-badge.js index 5b05ab807..b99c2061e 100644 --- a/public/javascripts/widgets/notifications-badge.js +++ b/public/javascripts/widgets/notifications-badge.js @@ -1,4 +1,4 @@ -(function() { +$(function() { $("#notification_badge a").live("click", function(event){ event.preventDefault(); $.getJSON("/notifications", function(hash) { @@ -15,7 +15,7 @@ dayElement.find(".day").text(dayParts[1]) var notificationsForDay = hash["group_days"][day], notificationsForDayElement = dayElement.find('.notifications_for_day'); - + $.each(notificationsForDay, function(i, notificationHash) { $.each(notificationHash, function(notificationType, notification) { var actor = notification.actors[0]; @@ -23,12 +23,14 @@ streamElement.find(".actor") .text(actor.name) .attr("href", notification.actors[0]["url"]); - streamElement.find('time').text(notification["created_at"]); + streamElement.find('time').attr("datetime", notification["created_at"]); }); }); - notificationsElement.append(dayElement); + notificationsElement.append(dayElement) + + Diaspora.widgets.timeago.updateTimeAgo("time"); }); }); }); -})(); \ No newline at end of file +}); \ No newline at end of file