Commit a2355c52507a40ed1805e4e6138778bbd0011ee4

Authored by Dmitriy Zaporozhets
2 parents 24820d5e 9a31844e

Merge branch 'timeago_js' of /home/git/repositories/gitlab/gitlabhq

app/assets/javascripts/main.js.coffee
@@ -81,6 +81,7 @@ $ -> @@ -81,6 +81,7 @@ $ ->
81 $(@).parents('form').submit() 81 $(@).parents('form').submit()
82 82
83 $("abbr.timeago").timeago() 83 $("abbr.timeago").timeago()
  84 + $('.js-timeago').timeago()
84 85
85 # Flash 86 # Flash
86 if (flash = $(".flash-container")).length > 0 87 if (flash = $(".flash-container")).length > 0
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_with_tooltip(project.repository.commit.committed_date) + " ago" 75 + time_ago_with_tooltip(project.repository.commit.committed_date)
76 else 76 else
77 "Never" 77 "Never"
78 end 78 end
@@ -210,11 +210,11 @@ module ApplicationHelper @@ -210,11 +210,11 @@ module ApplicationHelper
210 210
211 def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago') 211 def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago')
212 capture_haml do 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 data: { toggle: 'tooltip', placement: placement } 215 data: { toggle: 'tooltip', placement: placement }
216 216
217 - haml_tag :script, "$('." + html_class + "').tooltip()" 217 + haml_tag :script, "$('." + html_class + "').timeago().tooltip()"
218 end.html_safe 218 end.html_safe
219 end 219 end
220 end 220 end
app/helpers/notes_helper.rb
@@ -23,11 +23,11 @@ module NotesHelper @@ -23,11 +23,11 @@ module NotesHelper
23 23
24 def note_timestamp(note) 24 def note_timestamp(note)
25 # Shows the created at time and the updated at time if different 25 # Shows the created at time and the updated at time if different
26 - ts = "#{time_ago_with_tooltip(note.created_at, 'bottom', 'note_created_ago')} ago" 26 + ts = "#{time_ago_with_tooltip(note.created_at, 'bottom', 'note_created_ago')}"
27 if note.updated_at != note.created_at 27 if note.updated_at != note.created_at
28 ts << capture_haml do 28 ts << capture_haml do
29 haml_tag :small do 29 haml_tag :small do
30 - haml_concat " (Edited #{time_ago_with_tooltip(note.updated_at, 'bottom', 'note_edited_ago')} ago)" 30 + haml_concat " (Edited #{time_ago_with_tooltip(note.updated_at, 'bottom', 'note_edited_ago')})"
31 end 31 end
32 end 32 end
33 end 33 end
app/helpers/projects_helper.rb
@@ -190,7 +190,7 @@ module ProjectsHelper @@ -190,7 +190,7 @@ module ProjectsHelper
190 190
191 def project_last_activity(project) 191 def project_last_activity(project)
192 if project.last_activity_at 192 if project.last_activity_at
193 - time_ago_with_tooltip(project.last_activity_at, 'bottom', 'last_activity_time_ago') + " ago" 193 + time_ago_with_tooltip(project.last_activity_at, 'bottom', 'last_activity_time_ago')
194 else 194 else
195 "Never" 195 "Never"
196 end 196 end
app/views/admin/dashboard/index.html.haml
@@ -37,7 +37,7 @@ @@ -37,7 +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_with_tooltip(project.created_at)} ago 40 + #{time_ago_with_tooltip(project.created_at)}
41 41
42 .span4 42 .span4
43 %h4 Latest users 43 %h4 Latest users
@@ -47,7 +47,7 @@ @@ -47,7 +47,7 @@
47 = link_to [:admin, user] do 47 = link_to [:admin, user] do
48 = user.name 48 = user.name
49 %span.light.pull-right 49 %span.light.pull-right
50 - #{time_ago_with_tooltip(user.created_at)} ago 50 + #{time_ago_with_tooltip(user.created_at)}
51 51
52 .span4 52 .span4
53 %h4 Latest groups 53 %h4 Latest groups
@@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
57 = link_to [:admin, group] do 57 = link_to [:admin, group] do
58 = group.name 58 = group.name
59 %span.light.pull-right 59 %span.light.pull-right
60 - #{time_ago_with_tooltip(group.created_at)} ago 60 + #{time_ago_with_tooltip(group.created_at)}
61 61
62 %br 62 %br
63 .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_with_tooltip(event.created_at)} ago 4 + #{time_ago_with_tooltip(event.created_at)}
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,7 +5,7 @@ @@ -5,7 +5,7 @@
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 - #{time_ago_with_tooltip(event.created_at)} ago 8 + #{time_ago_with_tooltip(event.created_at)}
9 9
10 .pull-right 10 .pull-right
11 = 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
app/views/profiles/keys/_key.html.haml
@@ -4,6 +4,6 @@ @@ -4,6 +4,6 @@
4 %span 4 %span
5 (#{key.fingerprint}) 5 (#{key.fingerprint})
6 %span.cgray 6 %span.cgray
7 - added #{time_ago_with_tooltip(key.created_at)} ago 7 + added #{time_ago_with_tooltip(key.created_at)}
8 8
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" 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,4 +27,4 @@ @@ -27,4 +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 - #{time_ago_with_tooltip(commit.committed_date)} ago 30 + #{time_ago_with_tooltip(commit.committed_date)}
app/views/projects/commit/_commit_box.html.haml
@@ -23,14 +23,14 @@ @@ -23,14 +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_ago_with_tooltip(@commit.authored_date)} ago 26 + #{time_ago_with_tooltip(@commit.authored_date)}
27 27
28 - if @commit.different_committer? 28 - if @commit.different_committer?
29 .commit-info-row 29 .commit-info-row
30 %span.light Committed by 30 %span.light Committed by
31 %strong 31 %strong
32 = commit_committer_link(@commit, avatar: true, size: 24) 32 = commit_committer_link(@commit, avatar: true, size: 24)
33 - #{time_ago_with_tooltip(@commit.committed_date)} ago 33 + #{time_ago_with_tooltip(@commit.committed_date)}
34 34
35 .commit-info-row 35 .commit-info-row
36 %span.cgray= pluralize(@commit.parents.count, "parent") 36 %span.cgray= pluralize(@commit.parents.count, "parent")
app/views/projects/commits/_commit.html.haml
@@ -14,4 +14,4 @@ @@ -14,4 +14,4 @@
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 .committed_ago 16 .committed_ago
17 - #{time_ago_with_tooltip(commit.committed_date)} ago &nbsp; 17 + #{time_ago_with_tooltip(commit.committed_date)} &nbsp;
app/views/projects/commits/_inline_commit.html.haml
@@ -3,4 +3,4 @@ @@ -3,4 +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 &nbsp; 4 &nbsp;
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_ago_with_tooltip(commit.committed_date)} ago &nbsp; 6 + #{time_ago_with_tooltip(commit.committed_date)} &nbsp;
app/views/projects/deploy_keys/_deploy_key.html.haml
@@ -21,4 +21,4 @@ @@ -21,4 +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.label-gray.deploy-project-label= project_name 22 %span.label.label-gray.deploy-project-label= project_name
23 %small.pull-right 23 %small.pull-right
24 - Created #{time_ago_with_tooltip(deploy_key.created_at)} ago 24 + Created #{time_ago_with_tooltip(deploy_key.created_at)}
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_with_tooltip(issue.updated_at, 'bottom', 'issue_update_ago')} ago 29 + %small updated #{time_ago_with_tooltip(issue.updated_at, 'bottom', 'issue_update_ago')}
30 30
31 .issue-labels 31 .issue-labels
32 - issue.labels.each do |label| 32 - issue.labels.each do |label|
app/views/projects/issues/show.html.haml
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 Issue ##{@issue.iid} 2 Issue ##{@issue.iid}
3 3
4 %small 4 %small
5 - created #{time_ago_with_tooltip(@issue.created_at)} ago 5 + created #{time_ago_with_tooltip(@issue.created_at)}
6 6
7 - if @issue.closed? 7 - if @issue.closed?
8 %span.state-label.state-label-red Closed 8 %span.state-label.state-label-red Closed
app/views/projects/merge_requests/_merge_request.html.haml
@@ -34,4 +34,4 @@ @@ -34,4 +34,4 @@
34 34
35 35
36 .pull-right 36 .pull-right
37 - %small updated #{time_ago_with_tooltip(merge_request.updated_at, 'bottom', 'merge_request_updated_ago')} ago 37 + %small updated #{time_ago_with_tooltip(merge_request.updated_at, 'bottom', 'merge_request_updated_ago')}
app/views/projects/merge_requests/show/_mr_box.html.haml
@@ -25,13 +25,13 @@ @@ -25,13 +25,13 @@
25 %span 25 %span
26 %i.icon-remove 26 %i.icon-remove
27 Closed by #{link_to_member(@project, @merge_request.closed_event.author)} 27 Closed by #{link_to_member(@project, @merge_request.closed_event.author)}
28 - #{time_ago_with_tooltip(@merge_request.closed_event.created_at)} ago. 28 + #{time_ago_with_tooltip(@merge_request.closed_event.created_at)}.
29 - if @merge_request.merged? 29 - if @merge_request.merged?
30 .description.alert-success 30 .description.alert-success
31 %span 31 %span
32 %i.icon-ok 32 %i.icon-ok
33 Merged by #{link_to_member(@project, @merge_request.merge_event.author)} 33 Merged by #{link_to_member(@project, @merge_request.merge_event.author)}
34 - #{time_ago_with_tooltip(@merge_request.merge_event.created_at)} ago. 34 + #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}.
35 - if !@closes_issues.empty? && @merge_request.opened? 35 - if !@closes_issues.empty? && @merge_request.opened?
36 .description.alert-info 36 .description.alert-info
37 %span 37 %span
app/views/projects/merge_requests/show/_mr_title.html.haml
1 %h3.page-title 1 %h3.page-title
2 = "Merge Request ##{@merge_request.iid}" 2 = "Merge Request ##{@merge_request.iid}"
3 %small 3 %small
4 - created #{time_ago_with_tooltip(@merge_request.created_at)} ago 4 + created #{time_ago_with_tooltip(@merge_request.created_at)}
5 5
6 - if @merge_request.merged? 6 - if @merge_request.merged?
7 %span.state-label.state-label-green 7 %span.state-label.state-label-green
app/views/projects/notes/_discussion.html.haml
@@ -32,7 +32,7 @@ @@ -32,7 +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_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} ago 35 + #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')}
36 .discussion-body 36 .discussion-body
37 - if note.for_diff_line? 37 - if note.for_diff_line?
38 - if note.active? 38 - if note.active?
app/views/projects/protected_branches/index.html.haml
@@ -46,6 +46,6 @@ @@ -46,6 +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 - #{time_ago_with_tooltip(commit.committed_date)} ago 49 + #{time_ago_with_tooltip(commit.committed_date)}
50 - else 50 - else
51 (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_with_tooltip(commit.committed_date)} ago'); 8 + row.find("td.tree_time_ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)}');
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/repositories/_feed.html.haml
@@ -15,5 +15,4 @@ @@ -15,5 +15,4 @@
15 = gfm escape_once(truncate(commit.title, length: 40)) 15 = gfm escape_once(truncate(commit.title, length: 40))
16 %td 16 %td
17 %span.pull-right.cgray 17 %span.pull-right.cgray
18 - = time_ago_in_words(commit.committed_date)  
19 - ago 18 + = time_ago_with_tooltip(commit.committed_date)
app/views/projects/snippets/_snippet.html.haml
@@ -19,4 +19,4 @@ @@ -19,4 +19,4 @@
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 21 %span.light
22 - #{time_ago_with_tooltip(snippet.created_at)} ago 22 + #{time_ago_with_tooltip(snippet.created_at)}
app/views/projects/tags/index.html.haml
@@ -24,7 +24,7 @@ @@ -24,7 +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_with_tooltip(commit.committed_date)} ago 27 + #{time_ago_with_tooltip(commit.committed_date)}
28 %p.prepend-left-20 28 %p.prepend-left-20
29 = 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"
30 &ndash; 30 &ndash;
app/views/projects/wikis/history.html.haml
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 %td 23 %td
24 = commit.title 24 = commit.title
25 %td 25 %td
26 - #{time_ago_with_tooltip(version.date)} ago 26 + #{time_ago_with_tooltip(version.date)}
27 %td 27 %td
28 %strong 28 %strong
29 = @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_with_tooltip(wiki_page.commit.created_at)} ago 11 + %small Last edited #{time_ago_with_tooltip(wiki_page.commit.created_at)}
app/views/projects/wikis/show.html.haml
@@ -17,4 +17,4 @@ @@ -17,4 +17,4 @@
17 %hr 17 %hr
18 18
19 .wiki-last-edit-by 19 .wiki-last-edit-by
20 - Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_with_tooltip(@wiki.commit.created_at)} ago 20 + Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_with_tooltip(@wiki.commit.created_at)}
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_with_tooltip(snippet.created_at)} ago 23 + %span.light #{time_ago_with_tooltip(snippet.created_at)}