Commit 9a7e2399 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Use jquery timeago plugin

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent e2dbe0fa
...@@ -81,6 +81,7 @@ $ -> ...@@ -81,6 +81,7 @@ $ ->
$(@).parents('form').submit() $(@).parents('form').submit()
$("abbr.timeago").timeago() $("abbr.timeago").timeago()
$('.js-timeago').timeago()
# Flash # Flash
if (flash = $(".flash-container")).length > 0 if (flash = $(".flash-container")).length > 0
......
...@@ -72,7 +72,7 @@ module ApplicationHelper ...@@ -72,7 +72,7 @@ module ApplicationHelper
def last_commit(project) def last_commit(project)
if project.repo_exists? if project.repo_exists?
time_ago_with_tooltip(project.repository.commit.committed_date) + " ago" time_ago_with_tooltip(project.repository.commit.committed_date)
else else
"Never" "Never"
end end
...@@ -210,11 +210,11 @@ module ApplicationHelper ...@@ -210,11 +210,11 @@ module ApplicationHelper
def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago') def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago')
capture_haml do capture_haml do
haml_tag :time, time_ago_in_words(date), haml_tag :time, date.to_s,
class: html_class, datetime: date, title: date.stamp("Aug 21, 2011 9:23pm"), class: html_class, datetime: date.getutc.iso8601, title: date.stamp("Aug 21, 2011 9:23pm"),
data: { toggle: 'tooltip', placement: placement } data: { toggle: 'tooltip', placement: placement }
haml_tag :script, "$('." + html_class + "').tooltip()" haml_tag :script, "$('." + html_class + "').timeago().tooltip()"
end.html_safe end.html_safe
end end
end end
- if event.proper? - if event.proper?
.event-item{class: "#{event.body? ? "event-block" : "event-inline" }"} .event-item{class: "#{event.body? ? "event-block" : "event-inline" }"}
%span.cgray.pull-right %span.cgray.pull-right
#{time_ago_with_tooltip(event.created_at)} ago #{time_ago_with_tooltip(event.created_at)}
= cache event do = cache event do
= image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:'' = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment