summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorDrew Blessing <drew.blessing@buckle.com>2013-12-13 15:31:23 -0600
committerDrew Blessing <drew.blessing@buckle.com>2013-12-14 15:24:12 -0600
commitfa817dffeae76fa101ee8849bbac645307c0c82f (patch)
treeef178d626e0c5ed372e9f5d55697bd02e8660f60 /app/helpers
parentd476ac7d41f117ad9cf612e99216a4e7eaa04fb6 (diff)
downloadgitlab-ce-fa817dffeae76fa101ee8849bbac645307c0c82f.tar.gz
Add time ago tooltips to show actual date/time
Clean up admin dashboad tooltips Clean up admin dashboad tooltips Clean up admin dashboad tooltips Add helper method change to use app helper Modify tooltips to use new helper Convert remaining times Adjust one tooltip
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb16
-rw-r--r--app/helpers/notes_helper.rb10
2 files changed, 21 insertions, 5 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 4b9514750a9..c17f5aef01a 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -72,7 +72,7 @@ module ApplicationHelper
def last_commit(project)
if project.repo_exists?
- time_ago_in_words(project.repository.commit.committed_date) + " ago"
+ time_ago_with_tooltip(project.repository.commit.committed_date) + " ago"
else
"Never"
end
@@ -136,9 +136,9 @@ module ApplicationHelper
Digest::SHA1.hexdigest string
end
- def project_last_activity project
+ def project_last_activity(project)
if project.last_activity_at
- time_ago_in_words(project.last_activity_at) + " ago"
+ time_ago_with_tooltip(project.last_activity_at, 'bottom', 'last_activity_time_ago') + " ago"
else
"Never"
end
@@ -215,4 +215,14 @@ module ApplicationHelper
Pygments::Lexer[:js].highlight(string).html_safe
end
end
+
+ 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"),
+ data: { toggle: 'tooltip', placement: placement }
+
+ haml_tag :script, "$('." + html_class + "').tooltip()"
+ end.html_safe
+ end
end
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index a3ec4cca59d..822d27cf179 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -31,8 +31,14 @@ module NotesHelper
def note_timestamp(note)
# Shows the created at time and the updated at time if different
- ts = "#{time_ago_in_words(note.created_at)} ago"
- ts << content_tag(:small, " (Edited #{time_ago_in_words(note.updated_at)} ago)") if note.updated_at != note.created_at
+ ts = "#{time_ago_with_tooltip(note.created_at, 'bottom', 'note_created_ago')} ago"
+ if note.updated_at != note.created_at
+ ts << capture_haml do
+ haml_tag :small do
+ haml_concat " (Edited #{time_ago_with_tooltip(note.updated_at, 'bottom', 'note_edited_ago')} ago)"
+ end
+ end
+ end
ts.html_safe
end
end