Commit fa817dffeae76fa101ee8849bbac645307c0c82f
1 parent
d476ac7d
Exists in
master
and in
4 other branches
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
Showing
23 changed files
with
48 additions
and
53 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -72,7 +72,7 @@ module ApplicationHelper | @@ -72,7 +72,7 @@ module ApplicationHelper | ||
72 | 72 | ||
73 | def last_commit(project) | 73 | def last_commit(project) |
74 | if project.repo_exists? | 74 | if project.repo_exists? |
75 | - time_ago_in_words(project.repository.commit.committed_date) + " ago" | 75 | + time_ago_with_tooltip(project.repository.commit.committed_date) + " ago" |
76 | else | 76 | else |
77 | "Never" | 77 | "Never" |
78 | end | 78 | end |
@@ -136,9 +136,9 @@ module ApplicationHelper | @@ -136,9 +136,9 @@ module ApplicationHelper | ||
136 | Digest::SHA1.hexdigest string | 136 | Digest::SHA1.hexdigest string |
137 | end | 137 | end |
138 | 138 | ||
139 | - def project_last_activity project | 139 | + def project_last_activity(project) |
140 | if project.last_activity_at | 140 | if project.last_activity_at |
141 | - time_ago_in_words(project.last_activity_at) + " ago" | 141 | + time_ago_with_tooltip(project.last_activity_at, 'bottom', 'last_activity_time_ago') + " ago" |
142 | else | 142 | else |
143 | "Never" | 143 | "Never" |
144 | end | 144 | end |
@@ -215,4 +215,14 @@ module ApplicationHelper | @@ -215,4 +215,14 @@ module ApplicationHelper | ||
215 | Pygments::Lexer[:js].highlight(string).html_safe | 215 | Pygments::Lexer[:js].highlight(string).html_safe |
216 | end | 216 | end |
217 | end | 217 | end |
218 | + | ||
219 | + def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago') | ||
220 | + capture_haml do | ||
221 | + haml_tag :time, time_ago_in_words(date), | ||
222 | + class: html_class, datetime: date, title: date.stamp("Aug 21, 2011 9:23pm"), | ||
223 | + data: { toggle: 'tooltip', placement: placement } | ||
224 | + | ||
225 | + haml_tag :script, "$('." + html_class + "').tooltip()" | ||
226 | + end.html_safe | ||
227 | + end | ||
218 | end | 228 | end |
app/helpers/notes_helper.rb
@@ -31,8 +31,14 @@ module NotesHelper | @@ -31,8 +31,14 @@ module NotesHelper | ||
31 | 31 | ||
32 | def note_timestamp(note) | 32 | def note_timestamp(note) |
33 | # Shows the created at time and the updated at time if different | 33 | # Shows the created at time and the updated at time if different |
34 | - ts = "#{time_ago_in_words(note.created_at)} ago" | ||
35 | - ts << content_tag(:small, " (Edited #{time_ago_in_words(note.updated_at)} ago)") if note.updated_at != note.created_at | 34 | + ts = "#{time_ago_with_tooltip(note.created_at, 'bottom', 'note_created_ago')} ago" |
35 | + if note.updated_at != note.created_at | ||
36 | + ts << capture_haml do | ||
37 | + haml_tag :small do | ||
38 | + haml_concat " (Edited #{time_ago_with_tooltip(note.updated_at, 'bottom', 'note_edited_ago')} ago)" | ||
39 | + end | ||
40 | + end | ||
41 | + end | ||
36 | ts.html_safe | 42 | ts.html_safe |
37 | end | 43 | end |
38 | end | 44 | end |
app/views/admin/dashboard/index.html.haml
@@ -37,8 +37,7 @@ | @@ -37,8 +37,7 @@ | ||
37 | %p | 37 | %p |
38 | = link_to project.name_with_namespace, [:admin, project] | 38 | = link_to project.name_with_namespace, [:admin, project] |
39 | %span.light.pull-right | 39 | %span.light.pull-right |
40 | - = time_ago_in_words project.created_at | ||
41 | - ago | 40 | + #{time_ago_with_tooltip(project.created_at)} ago |
42 | 41 | ||
43 | .span4 | 42 | .span4 |
44 | %h4 Latest users | 43 | %h4 Latest users |
@@ -48,8 +47,7 @@ | @@ -48,8 +47,7 @@ | ||
48 | = link_to [:admin, user] do | 47 | = link_to [:admin, user] do |
49 | = user.name | 48 | = user.name |
50 | %span.light.pull-right | 49 | %span.light.pull-right |
51 | - = time_ago_in_words user.created_at | ||
52 | - ago | 50 | + #{time_ago_with_tooltip(user.created_at)} ago |
53 | 51 | ||
54 | .span4 | 52 | .span4 |
55 | %h4 Latest groups | 53 | %h4 Latest groups |
@@ -59,8 +57,7 @@ | @@ -59,8 +57,7 @@ | ||
59 | = link_to [:admin, group] do | 57 | = link_to [:admin, group] do |
60 | = group.name | 58 | = group.name |
61 | %span.light.pull-right | 59 | %span.light.pull-right |
62 | - = time_ago_in_words group.created_at | ||
63 | - ago | 60 | + #{time_ago_with_tooltip(group.created_at)} ago |
64 | 61 | ||
65 | %br | 62 | %br |
66 | .row | 63 | .row |
app/views/events/_event.html.haml
1 | - if event.proper? | 1 | - if event.proper? |
2 | .event-item{class: "#{event.body? ? "event-block" : "event-inline" }"} | 2 | .event-item{class: "#{event.body? ? "event-block" : "event-inline" }"} |
3 | %span.cgray.pull-right | 3 | %span.cgray.pull-right |
4 | - #{time_ago_in_words(event.created_at)} ago. | 4 | + #{time_ago_with_tooltip(event.created_at)} ago |
5 | 5 | ||
6 | = cache event do | 6 | = cache event do |
7 | = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:'' | 7 | = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:'' |
app/views/events/_event_last_push.html.haml
@@ -5,9 +5,8 @@ | @@ -5,9 +5,8 @@ | ||
5 | %strong= truncate(event.ref_name, length: 28) | 5 | %strong= truncate(event.ref_name, length: 28) |
6 | at | 6 | at |
7 | %strong= link_to_project event.project | 7 | %strong= link_to_project event.project |
8 | - %span | ||
9 | - = time_ago_in_words(event.created_at) | ||
10 | - ago. | 8 | + #{time_ago_with_tooltip(event.created_at)} ago |
9 | + | ||
11 | .pull-right | 10 | .pull-right |
12 | = link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-create btn-small" do | 11 | = link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-create btn-small" do |
13 | Create Merge Request | 12 | Create Merge Request |
app/views/profiles/keys/_key.html.haml
@@ -4,8 +4,6 @@ | @@ -4,8 +4,6 @@ | ||
4 | %span | 4 | %span |
5 | (#{key.fingerprint}) | 5 | (#{key.fingerprint}) |
6 | %span.cgray | 6 | %span.cgray |
7 | - added | ||
8 | - = time_ago_in_words(key.created_at) | ||
9 | - ago | 7 | + added #{time_ago_with_tooltip(key.created_at)} ago |
10 | 8 | ||
11 | = link_to 'Remove', profile_key_path(key), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-small btn-remove delete-key pull-right" | 9 | = link_to 'Remove', profile_key_path(key), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-small btn-remove delete-key pull-right" |
app/views/projects/branches/_branch.html.haml
@@ -27,6 +27,4 @@ | @@ -27,6 +27,4 @@ | ||
27 | = image_tag avatar_icon(commit.author_email), class: "avatar s16", alt: '' | 27 | = image_tag avatar_icon(commit.author_email), class: "avatar s16", alt: '' |
28 | %span.light | 28 | %span.light |
29 | = gfm escape_once(truncate(commit.title, length: 40)) | 29 | = gfm escape_once(truncate(commit.title, length: 40)) |
30 | - %span | ||
31 | - = time_ago_in_words(commit.committed_date) | ||
32 | - ago | 30 | + #{time_ago_with_tooltip(commit.committed_date)} ago |
app/views/projects/commit/_commit_box.html.haml
@@ -23,16 +23,14 @@ | @@ -23,16 +23,14 @@ | ||
23 | %span.light Authored by | 23 | %span.light Authored by |
24 | %strong | 24 | %strong |
25 | = commit_author_link(@commit, avatar: true, size: 24) | 25 | = commit_author_link(@commit, avatar: true, size: 24) |
26 | - %time{title: @commit.authored_date.stamp("Aug 21, 2011 9:23pm")} | ||
27 | - #{time_ago_in_words(@commit.authored_date)} ago | 26 | + #{time_ago_with_tooltip(@commit.authored_date)} ago |
28 | 27 | ||
29 | - if @commit.different_committer? | 28 | - if @commit.different_committer? |
30 | .commit-info-row | 29 | .commit-info-row |
31 | %span.light Committed by | 30 | %span.light Committed by |
32 | %strong | 31 | %strong |
33 | = commit_committer_link(@commit, avatar: true, size: 24) | 32 | = commit_committer_link(@commit, avatar: true, size: 24) |
34 | - %time{title: @commit.committed_date.stamp("Aug 21, 2011 9:23pm")} | ||
35 | - #{time_ago_in_words(@commit.committed_date)} ago | 33 | + #{time_ago_with_tooltip(@commit.committed_date)} ago |
36 | 34 | ||
37 | .commit-info-row | 35 | .commit-info-row |
38 | %span.cgray= pluralize(@commit.parents.count, "parent") | 36 | %span.cgray= pluralize(@commit.parents.count, "parent") |
app/views/projects/commits/_commit.html.haml
@@ -13,7 +13,4 @@ | @@ -13,7 +13,4 @@ | ||
13 | 13 | ||
14 | .commit-row-info | 14 | .commit-row-info |
15 | = commit_author_link(commit, avatar: true, size: 16) | 15 | = commit_author_link(commit, avatar: true, size: 16) |
16 | - %time.committed_ago{ datetime: commit.committed_date, title: commit.committed_date.stamp("Aug 21, 2011 9:23pm") } | ||
17 | - = time_ago_in_words(commit.committed_date) | ||
18 | - ago | ||
19 | - | 16 | + #{time_ago_with_tooltip(commit.committed_date)} ago |
app/views/projects/commits/_inline_commit.html.haml
@@ -3,7 +3,4 @@ | @@ -3,7 +3,4 @@ | ||
3 | = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id" | 3 | = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id" |
4 | | 4 | |
5 | = link_to_gfm truncate(commit.title, length: 40), project_commit_path(project, commit.id), class: "commit-row-message" | 5 | = link_to_gfm truncate(commit.title, length: 40), project_commit_path(project, commit.id), class: "commit-row-message" |
6 | - %time.committed_ago{ datetime: commit.committed_date, title: commit.committed_date.stamp("Aug 21, 2011 9:23pm") } | ||
7 | - = time_ago_in_words(commit.committed_date) | ||
8 | - ago | ||
9 | - | 6 | + #{time_ago_with_tooltip(commit.committed_date)} ago |
app/views/projects/deploy_keys/_deploy_key.html.haml
@@ -21,5 +21,4 @@ | @@ -21,5 +21,4 @@ | ||
21 | - deploy_key.projects.map(&:name_with_namespace).each do |project_name| | 21 | - deploy_key.projects.map(&:name_with_namespace).each do |project_name| |
22 | %span.label= project_name | 22 | %span.label= project_name |
23 | %small.pull-right | 23 | %small.pull-right |
24 | - Created #{time_ago_in_words(deploy_key.created_at)} ago | ||
25 | - | 24 | + Created #{time_ago_with_tooltip(deploy_key.created_at)} ago |
app/views/projects/issues/_issue.html.haml
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | %i.icon-time | 26 | %i.icon-time |
27 | = issue.milestone.title | 27 | = issue.milestone.title |
28 | .pull-right | 28 | .pull-right |
29 | - %small updated #{time_ago_in_words(issue.updated_at)} ago | 29 | + %small updated #{time_ago_with_tooltip(issue.updated_at, 'bottom', 'issue_update_ago')} ago |
30 | 30 | ||
31 | .issue-labels | 31 | .issue-labels |
32 | - issue.labels.each do |label| | 32 | - issue.labels.each do |label| |
app/views/projects/merge_requests/_merge_request.html.haml
app/views/projects/merge_requests/show/_mr_box.html.haml
@@ -34,13 +34,13 @@ | @@ -34,13 +34,13 @@ | ||
34 | %span | 34 | %span |
35 | %i.icon-remove | 35 | %i.icon-remove |
36 | Closed by #{link_to_member(@project, @merge_request.closed_event.author)} | 36 | Closed by #{link_to_member(@project, @merge_request.closed_event.author)} |
37 | - %span #{time_ago_in_words(@merge_request.closed_event.created_at)} ago. | 37 | + #{time_ago_with_tooltip(@merge_request.closed_event.created_at)} ago. |
38 | - if @merge_request.merged? | 38 | - if @merge_request.merged? |
39 | .ui-box-bottom.alert-success | 39 | .ui-box-bottom.alert-success |
40 | %span | 40 | %span |
41 | %i.icon-ok | 41 | %i.icon-ok |
42 | Merged by #{link_to_member(@project, @merge_request.merge_event.author)} | 42 | Merged by #{link_to_member(@project, @merge_request.merge_event.author)} |
43 | - #{time_ago_in_words(@merge_request.merge_event.created_at)} ago. | 43 | + #{time_ago_with_tooltip(@merge_request.merge_event.created_at)} ago. |
44 | - if !@closes_issues.empty? && @merge_request.opened? | 44 | - if !@closes_issues.empty? && @merge_request.opened? |
45 | .ui-box-bottom.alert-info | 45 | .ui-box-bottom.alert-info |
46 | %span | 46 | %span |
app/views/projects/notes/_discussion.html.haml
@@ -32,8 +32,7 @@ | @@ -32,8 +32,7 @@ | ||
32 | last updated by | 32 | last updated by |
33 | = link_to_member(@project, last_note.author, avatar: false) | 33 | = link_to_member(@project, last_note.author, avatar: false) |
34 | %span.discussion-last-update | 34 | %span.discussion-last-update |
35 | - = time_ago_in_words(last_note.updated_at) | ||
36 | - ago | 35 | + #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} ago |
37 | .discussion-body | 36 | .discussion-body |
38 | - if note.for_diff_line? | 37 | - if note.for_diff_line? |
39 | - if note.active? | 38 | - if note.active? |
app/views/projects/protected_branches/index.html.haml
@@ -46,8 +46,6 @@ | @@ -46,8 +46,6 @@ | ||
46 | = commit.short_id | 46 | = commit.short_id |
47 | %span.light | 47 | %span.light |
48 | = gfm escape_once(truncate(commit.title, length: 40)) | 48 | = gfm escape_once(truncate(commit.title, length: 40)) |
49 | - %span | ||
50 | - = time_ago_in_words(commit.committed_date) | ||
51 | - ago | 49 | + #{time_ago_with_tooltip(commit.committed_date)} ago |
52 | - else | 50 | - else |
53 | (branch was removed from repository) | 51 | (branch was removed from repository) |
app/views/projects/refs/logs_tree.js.haml
@@ -5,5 +5,5 @@ | @@ -5,5 +5,5 @@ | ||
5 | 5 | ||
6 | :plain | 6 | :plain |
7 | var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}"); | 7 | var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}"); |
8 | - row.find("td.tree_time_ago").html('#{escape_javascript time_ago_in_words(commit.committed_date)} ago'); | 8 | + row.find("td.tree_time_ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)} ago'); |
9 | row.find("td.tree_commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}'); | 9 | row.find("td.tree_commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}'); |
app/views/projects/snippets/_snippet.html.haml
@@ -18,4 +18,5 @@ | @@ -18,4 +18,5 @@ | ||
18 | by | 18 | by |
19 | = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16" | 19 | = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16" |
20 | = snippet.author_name | 20 | = snippet.author_name |
21 | - %span.light #{time_ago_in_words(snippet.created_at)} ago | 21 | + %span.light |
22 | + #{time_ago_with_tooltip(snippet.created_at)} ago |
app/views/projects/tags/index.html.haml
@@ -24,8 +24,7 @@ | @@ -24,8 +24,7 @@ | ||
24 | .pull-right | 24 | .pull-right |
25 | %small.cdark | 25 | %small.cdark |
26 | %i.icon-calendar | 26 | %i.icon-calendar |
27 | - = time_ago_in_words(commit.committed_date) | ||
28 | - ago | 27 | + #{time_ago_with_tooltip(commit.committed_date)} ago |
29 | %p.prepend-left-20 | 28 | %p.prepend-left-20 |
30 | = link_to commit.short_id(8), project_commit_path(@project, commit), class: "monospace" | 29 | = link_to commit.short_id(8), project_commit_path(@project, commit), class: "monospace" |
31 | – | 30 | – |
app/views/projects/wikis/history.html.haml
@@ -23,8 +23,7 @@ | @@ -23,8 +23,7 @@ | ||
23 | %td | 23 | %td |
24 | = commit.title | 24 | = commit.title |
25 | %td | 25 | %td |
26 | - = time_ago_in_words(version.date) | ||
27 | - ago | 26 | + #{time_ago_with_tooltip(version.date)} ago |
28 | %td | 27 | %td |
29 | %strong | 28 | %strong |
30 | = @wiki.page.wiki.page(@wiki.page.name, commit.id).try(:format) | 29 | = @wiki.page.wiki.page(@wiki.page.name, commit.id).try(:format) |
app/views/projects/wikis/pages.html.haml
@@ -8,4 +8,4 @@ | @@ -8,4 +8,4 @@ | ||
8 | = link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page) | 8 | = link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page) |
9 | %small (#{wiki_page.format}) | 9 | %small (#{wiki_page.format}) |
10 | .pull-right | 10 | .pull-right |
11 | - %small Last edited #{time_ago_in_words(wiki_page.commit.created_at)} ago | 11 | + %small Last edited #{time_ago_with_tooltip(wiki_page.commit.created_at)} ago |
app/views/projects/wikis/show.html.haml
@@ -12,4 +12,4 @@ | @@ -12,4 +12,4 @@ | ||
12 | = preserve do | 12 | = preserve do |
13 | = render_wiki_content(@wiki) | 13 | = render_wiki_content(@wiki) |
14 | 14 | ||
15 | -%p.time Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_in_words @wiki.commit.created_at} ago | 15 | +%p.span Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_with_tooltip(@wiki.commit.created_at)} ago |
app/views/snippets/_snippet.html.haml
@@ -20,4 +20,4 @@ | @@ -20,4 +20,4 @@ | ||
20 | = link_to user_snippets_path(snippet.author) do | 20 | = link_to user_snippets_path(snippet.author) do |
21 | = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: '' | 21 | = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: '' |
22 | = snippet.author_name | 22 | = snippet.author_name |
23 | - %span.light #{time_ago_in_words(snippet.created_at)} ago | 23 | + %span.light #{time_ago_with_tooltip(snippet.created_at)} ago |