diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7600b91..2a451b9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -11,4 +11,9 @@ module ApplicationHelper raw(html) end + + def time_ago_in_words_label(*args) + label_tag(nil, time_ago_in_words(*args), + :title => args.first.strftime("%F %T %z")) + end end diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 47cbbd0..3f8f53a 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -26,8 +26,8 @@ class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ? %> <%= comment.has_been_edited?? "edited" : "" %> - <%= time_ago_in_words(comment.has_been_edited?? comment.updated_at : - comment.created_at).gsub(/^about /, "") %> ago + <%= raw(time_ago_in_words_label(comment.has_been_edited? ? + comment.updated_at : comment.created_at).gsub(/^about /, "")) %> ago <% end %> <% if !comment.previewing %> diff --git a/app/views/messages/index.html.erb b/app/views/messages/index.html.erb index 1383e62..e476fcf 100644 --- a/app/views/messages/index.html.erb +++ b/app/views/messages/index.html.erb @@ -29,7 +29,7 @@ <%= message.recipient.username %> <% end %> - <%= time_ago_in_words(message.created_at) %> ago + <%= raw(time_ago_in_words_label(message.created_at)) %> ago <%= message.subject %> diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index b359b80..3d640f7 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -16,7 +16,7 @@ to <%= @message.recipient.username %> - <%= time_ago_in_words(@message.created_at) %> ago + <%= raw(time_ago_in_words_label(@message.created_at)) %> ago diff --git a/app/views/stories/_listdetail.html.erb b/app/views/stories/_listdetail.html.erb index ae33694..b6d1f3b 100644 --- a/app/views/stories/_listdetail.html.erb +++ b/app/views/stories/_listdetail.html.erb @@ -44,8 +44,8 @@ class="story <%= story.vote == 1 ? "upvoted" : (story.vote == -1 ? just now <% else %> by <%= story.user.username - %> <%= time_ago_in_words(story.created_at).gsub(/^about /, "") - %> ago + %> <%= raw(time_ago_in_words_label(story.created_at). + gsub(/^about /, "")) %> ago <% if story.is_editable_by_user?(@user) %> | diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 05e7ab1..4aafe30 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -19,7 +19,7 @@ - <%= time_ago_in_words(@showing_user.created_at) %> + <%= raw(time_ago_in_words_label(@showing_user.created_at)) %> <% if @showing_user.invited_by_user %> ago, invited by <%=