summaryrefslogtreecommitdiff
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-03-09 16:29:15 +0000
committerPhil Hughes <me@iamphill.com>2016-03-10 08:39:47 +0000
commitcd1d045fe215bb06a1cc96e12cefda5ef71058a0 (patch)
treec65a5e177268dab8d18c71a5d2f7028fbea02b91 /app/helpers/application_helper.rb
parent12506abfe794e75fcaa879b92bee09b8da57bf46 (diff)
downloadgitlab-ce-cd1d045fe215bb06a1cc96e12cefda5ef71058a0.tar.gz
Fixed issue with timeago not firing
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 212fecc3e77..5cd494079b0 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -179,13 +179,19 @@ module ApplicationHelper
# `html_class` argument is provided.
#
# Returns an HTML-safe String
- def time_ago_with_tooltip(time, placement: 'top', html_class: 'time_ago')
+ def time_ago_with_tooltip(time, placement: 'top', html_class: 'time_ago', skip_js: false)
element = content_tag :time, time.to_s,
- class: "#{html_class} js-timeago",
+ class: "#{html_class} js-timeago #{"js-timeago-pending" unless skip_js}",
datetime: time.to_time.getutc.iso8601,
title: time.in_time_zone.to_s(:medium),
data: { toggle: 'tooltip', placement: placement, container: 'body' }
+ unless skip_js
+ element << javascript_tag(
+ "$('.js-timeago-pending').removeClass('js-timeago-pending').timeago()"
+ )
+ end
+
element
end