Use jquery timeago plugin
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
e2dbe0fad7
commit
9a7e2399dd
|
@ -81,6 +81,7 @@ $ ->
|
|||
$(@).parents('form').submit()
|
||||
|
||||
$("abbr.timeago").timeago()
|
||||
$('.js-timeago').timeago()
|
||||
|
||||
# Flash
|
||||
if (flash = $(".flash-container")).length > 0
|
||||
|
|
|
@ -72,7 +72,7 @@ module ApplicationHelper
|
|||
|
||||
def last_commit(project)
|
||||
if project.repo_exists?
|
||||
time_ago_with_tooltip(project.repository.commit.committed_date) + " ago"
|
||||
time_ago_with_tooltip(project.repository.commit.committed_date)
|
||||
else
|
||||
"Never"
|
||||
end
|
||||
|
@ -210,11 +210,11 @@ module ApplicationHelper
|
|||
|
||||
def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago')
|
||||
capture_haml do
|
||||
haml_tag :time, time_ago_in_words(date),
|
||||
class: html_class, datetime: date, title: date.stamp("Aug 21, 2011 9:23pm"),
|
||||
haml_tag :time, date.to_s,
|
||||
class: html_class, datetime: date.getutc.iso8601, title: date.stamp("Aug 21, 2011 9:23pm"),
|
||||
data: { toggle: 'tooltip', placement: placement }
|
||||
|
||||
haml_tag :script, "$('." + html_class + "').tooltip()"
|
||||
haml_tag :script, "$('." + html_class + "').timeago().tooltip()"
|
||||
end.html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- if event.proper?
|
||||
.event-item{class: "#{event.body? ? "event-block" : "event-inline" }"}
|
||||
%span.cgray.pull-right
|
||||
#{time_ago_with_tooltip(event.created_at)} ago
|
||||
#{time_ago_with_tooltip(event.created_at)}
|
||||
|
||||
= cache event do
|
||||
= image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:''
|
||||
|
|
Loading…
Reference in New Issue