diff --git a/app/assets/javascripts/inbox.js b/app/assets/javascripts/inbox.js index 507032aaa7af787bb5857392137ea0af557b31a3..c1f367bdb2a07b9436828d5eef486cbe770c5b95 100644 --- a/app/assets/javascripts/inbox.js +++ b/app/assets/javascripts/inbox.js @@ -10,11 +10,28 @@ $(document).ready(function(){ $("html").scrollTop($('#first_unread').offset().top-45); } + $('time.timeago').each(function(i,e) { + var jqe = $(e); + jqe.attr('data-original-title', new Date(jqe.attr('datetime')).toLocaleString()); + jqe.attr('title', ''); + }); + + $('.timeago').tooltip(); + $('.timeago').timeago(); + + $('time.timeago').each(function(i,e) { + var jqe = $(e); + jqe.attr('title', ''); + }); + $('.conversation-wrapper').live('click', function(){ - $.getScript($(this).data('conversation-path'), function() { + var conversation_path = $(this).data('conversation-path'); + + $.getScript(conversation_path, function() { Diaspora.page.directionDetector.updateBinds(); }); - history.pushState(null, "", this.href); + + history.pushState(null, "", conversation_path); var conv = $(this).children('.stream_element'), cBadge = $("#message_inbox_badge .badge_count"); @@ -31,7 +48,6 @@ $(document).ready(function(){ }); } - jQuery("abbr.timeago").timeago(); return false; }); diff --git a/app/views/conversations/_conversation.haml b/app/views/conversations/_conversation.haml index 9e18e72b249d792404bffa1de9c6a8830fafb0cd..264c3767f0abe75ca2c97c2011e3296ffdf2d51c 100644 --- a/app/views/conversations/_conversation.haml +++ b/app/views/conversations/_conversation.haml @@ -15,7 +15,7 @@ :unread_count => unread_counts[conversation.id].to_i }) .last_author - .timestamp + %time.timeago.timestamp{:datetime => conversation.updated_at.iso8601} = t('ago', :time => time_ago_in_words(conversation.updated_at)) - if authors[conversation.id].present? diff --git a/app/views/conversations/show.js.erb b/app/views/conversations/show.js.erb index e0009ea26c814fb55a87b8c2960171e2327ec807..743b2197e6eb791f4ffc5df9a22285218342c92b 100644 --- a/app/views/conversations/show.js.erb +++ b/app/views/conversations/show.js.erb @@ -4,6 +4,19 @@ $(".stream_element", "#conversation_inbox").removeClass('selected'); $(".stream_element[data-guid='<%= @conversation.id %>']", "#conversation_inbox").addClass('selected'); $(".stream_element[data-guid='<%= @conversation.id %>']", "#conversation_inbox").find(".unread_message_count").remove() -$("html").scrollTop($('#first_unread').offset().top-45); +$('time.timeago').each(function(i,e) { + var jqe = $(e); + jqe.attr('data-original-title', new Date(jqe.attr('datetime')).toLocaleString()); +}); -Diaspora.page.timeAgo.updateTimeAgo(); +if ($('#first_unread') > 0) { + $("html").scrollTop($('#first_unread').offset().top-45); +} + +$(".timeago").tooltip(); +$("time.timeago").timeago(); + +$('time.timeago').each(function(i,e) { + var jqe = $(e); + jqe.attr('title', ''); +}); diff --git a/app/views/messages/_message.haml b/app/views/messages/_message.haml index 12607e02407443459a447bd7c82d780133312c3d..bcce45bda02b822bd450727546d3e7ae77e21a9f 100644 --- a/app/views/messages/_message.haml +++ b/app/views/messages/_message.haml @@ -8,7 +8,7 @@ = person_image_link(message.author, :size => :thumb_small) .bd = person_link(message.author, :class => 'author from') - %time.timeago{:datetime => message.created_at} + %time.timeago{:datetime => message.created_at.iso8601} = t('ago', :time => time_ago_in_words(message.created_at)) %div{ :class => direction_for(message.text) } diff --git a/features/conversations.feature b/features/conversations.feature index 6dd07ef41e6c1a5bd92f46f92744735dcf635430..b78e7af43de4fe91b2ffeaba320d2c05577d39ca 100644 --- a/features/conversations.feature +++ b/features/conversations.feature @@ -14,6 +14,8 @@ Feature: private messages Given I send a message with subject "Greetings" and text "hello, alice!" to "Alice Awesome" Then I should see "Greetings" within "#conversation_inbox" And I should see "Greetings" within "#conversation_show" + And I should see "less than a minute ago" within "#conversation_inbox" + And I should see "less than a minute ago" within "#conversation_show" And I click on selector "a.participants_link" Then I should see the participants popover And I should see "Alice Awesome" as part of the participants popover