add time_ago_in_words_label helper that shows the real time as a label title

This commit is contained in:
joshua stein 2013-02-22 11:22:39 -06:00
parent 97831574f1
commit 87cb2cb45b
6 changed files with 12 additions and 7 deletions

View file

@ -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

View file

@ -26,8 +26,8 @@ class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ?
%></a>
<%= 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 %>

View file

@ -29,7 +29,7 @@
<a href="/u/<%= message.recipient.username %>"><%=
message.recipient.username %></a>
<% end %></td>
<td><%= time_ago_in_words(message.created_at) %> ago</td>
<td><%= raw(time_ago_in_words_label(message.created_at)) %> ago</td>
<td><a href="/messages/<%= message.short_id %>"><%= message.subject
%></a></td>
</tr>

View file

@ -16,7 +16,7 @@
to
<a href="/u/<%= @message.recipient.username %>"><%=
@message.recipient.username %></a>
<%= time_ago_in_words(@message.created_at) %> ago
<%= raw(time_ago_in_words_label(@message.created_at)) %> ago
</div>
</div>

View file

@ -44,8 +44,8 @@ class="story <%= story.vote == 1 ? "upvoted" : (story.vote == -1 ?
just now
<% else %>
by <a href="/u/<%= story.user.username %>"><%= story.user.username
%></a> <%= time_ago_in_words(story.created_at).gsub(/^about /, "")
%> ago
%></a> <%= raw(time_ago_in_words_label(story.created_at).
gsub(/^about /, "")) %> ago
<% if story.is_editable_by_user?(@user) %>
|

View file

@ -19,7 +19,7 @@
<label class="required">Joined:</label>
<span class="d">
<%= 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
<a href="/u/<%= @showing_user.invited_by_user.username %>"><%=