Commit 9a7e2399dd766bae96ed15b6e6d4c69374d310fe

Authored by Dmitriy Zaporozhets
1 parent e2dbe0fa

Use jquery timeago plugin

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/assets/javascripts/main.js.coffee
... ... @@ -81,6 +81,7 @@ $ -&gt;
81 81 $(@).parents('form').submit()
82 82  
83 83 $("abbr.timeago").timeago()
  84 + $('.js-timeago').timeago()
84 85  
85 86 # Flash
86 87 if (flash = $(".flash-container")).length > 0
... ...
app/helpers/application_helper.rb
... ... @@ -72,7 +72,7 @@ module ApplicationHelper
72 72  
73 73 def last_commit(project)
74 74 if project.repo_exists?
75   - time_ago_with_tooltip(project.repository.commit.committed_date) + " ago"
  75 + time_ago_with_tooltip(project.repository.commit.committed_date)
76 76 else
77 77 "Never"
78 78 end
... ... @@ -210,11 +210,11 @@ module ApplicationHelper
210 210  
211 211 def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago')
212 212 capture_haml do
213   - haml_tag :time, time_ago_in_words(date),
214   - class: html_class, datetime: date, title: date.stamp("Aug 21, 2011 9:23pm"),
  213 + haml_tag :time, date.to_s,
  214 + class: html_class, datetime: date.getutc.iso8601, title: date.stamp("Aug 21, 2011 9:23pm"),
215 215 data: { toggle: 'tooltip', placement: placement }
216 216  
217   - haml_tag :script, "$('." + html_class + "').tooltip()"
  217 + haml_tag :script, "$('." + html_class + "').timeago().tooltip()"
218 218 end.html_safe
219 219 end
220 220 end
... ...
app/views/events/_event.html.haml
1 1 - if event.proper?
2 2 .event-item{class: "#{event.body? ? "event-block" : "event-inline" }"}
3 3 %span.cgray.pull-right
4   - #{time_ago_with_tooltip(event.created_at)} ago
  4 + #{time_ago_with_tooltip(event.created_at)}
5 5  
6 6 = cache event do
7 7 = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:''
... ...