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 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/helpers/notes_helper.rb
... ... @@ -23,11 +23,11 @@ module NotesHelper
23 23  
24 24 def note_timestamp(note)
25 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 27 if note.updated_at != note.created_at
28 28 ts << capture_haml do
29 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 31 end
32 32 end
33 33 end
... ...
app/helpers/projects_helper.rb
... ... @@ -190,7 +190,7 @@ module ProjectsHelper
190 190  
191 191 def project_last_activity(project)
192 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 194 else
195 195 "Never"
196 196 end
... ...
app/views/admin/dashboard/index.html.haml
... ... @@ -37,7 +37,7 @@
37 37 %p
38 38 = link_to project.name_with_namespace, [:admin, project]
39 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 42 .span4
43 43 %h4 Latest users
... ... @@ -47,7 +47,7 @@
47 47 = link_to [:admin, user] do
48 48 = user.name
49 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 52 .span4
53 53 %h4 Latest groups
... ... @@ -57,7 +57,7 @@
57 57 = link_to [:admin, group] do
58 58 = group.name
59 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 62 %br
63 63 .row
... ...
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:''
... ...
app/views/events/_event_last_push.html.haml
... ... @@ -5,7 +5,7 @@
5 5 %strong= truncate(event.ref_name, length: 28)
6 6 at
7 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 10 .pull-right
11 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 4 %span
5 5 (#{key.fingerprint})
6 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 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 27 = image_tag avatar_icon(commit.author_email), class: "avatar s16", alt: ''
28 28 %span.light
29 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 23 %span.light Authored by
24 24 %strong
25 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 28 - if @commit.different_committer?
29 29 .commit-info-row
30 30 %span.light Committed by
31 31 %strong
32 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 35 .commit-info-row
36 36 %span.cgray= pluralize(@commit.parents.count, "parent")
... ...
app/views/projects/commits/_commit.html.haml
... ... @@ -14,4 +14,4 @@
14 14 .commit-row-info
15 15 = commit_author_link(commit, avatar: true, size: 16)
16 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 3 = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id"
4 4 &nbsp;
5 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 21 - deploy_key.projects.map(&:name_with_namespace).each do |project_name|
22 22 %span.label.label-gray.deploy-project-label= project_name
23 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 26 %i.icon-time
27 27 = issue.milestone.title
28 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 31 .issue-labels
32 32 - issue.labels.each do |label|
... ...
app/views/projects/issues/show.html.haml
... ... @@ -2,7 +2,7 @@
2 2 Issue ##{@issue.iid}
3 3  
4 4 %small
5   - created #{time_ago_with_tooltip(@issue.created_at)} ago
  5 + created #{time_ago_with_tooltip(@issue.created_at)}
6 6  
7 7 - if @issue.closed?
8 8 %span.state-label.state-label-red Closed
... ...
app/views/projects/merge_requests/_merge_request.html.haml
... ... @@ -34,4 +34,4 @@
34 34  
35 35  
36 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 25 %span
26 26 %i.icon-remove
27 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 29 - if @merge_request.merged?
30 30 .description.alert-success
31 31 %span
32 32 %i.icon-ok
33 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 35 - if !@closes_issues.empty? && @merge_request.opened?
36 36 .description.alert-info
37 37 %span
... ...
app/views/projects/merge_requests/show/_mr_title.html.haml
1 1 %h3.page-title
2 2 = "Merge Request ##{@merge_request.iid}"
3 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 6 - if @merge_request.merged?
7 7 %span.state-label.state-label-green
... ...
app/views/projects/notes/_discussion.html.haml
... ... @@ -32,7 +32,7 @@
32 32 last updated by
33 33 = link_to_member(@project, last_note.author, avatar: false)
34 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 36 .discussion-body
37 37 - if note.for_diff_line?
38 38 - if note.active?
... ...
app/views/projects/protected_branches/index.html.haml
... ... @@ -46,6 +46,6 @@
46 46 = commit.short_id
47 47 %span.light
48 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 50 - else
51 51 (branch was removed from repository)
... ...
app/views/projects/refs/logs_tree.js.haml
... ... @@ -5,5 +5,5 @@
5 5  
6 6 :plain
7 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 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 15 = gfm escape_once(truncate(commit.title, length: 40))
16 16 %td
17 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 19 = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16"
20 20 = snippet.author_name
21 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 24 .pull-right
25 25 %small.cdark
26 26 %i.icon-calendar
27   - #{time_ago_with_tooltip(commit.committed_date)} ago
  27 + #{time_ago_with_tooltip(commit.committed_date)}
28 28 %p.prepend-left-20
29 29 = link_to commit.short_id(8), project_commit_path(@project, commit), class: "monospace"
30 30 &ndash;
... ...
app/views/projects/wikis/history.html.haml
... ... @@ -23,7 +23,7 @@
23 23 %td
24 24 = commit.title
25 25 %td
26   - #{time_ago_with_tooltip(version.date)} ago
  26 + #{time_ago_with_tooltip(version.date)}
27 27 %td
28 28 %strong
29 29 = @wiki.page.wiki.page(@wiki.page.name, commit.id).try(:format)
... ...
app/views/projects/wikis/pages.html.haml
... ... @@ -8,4 +8,4 @@
8 8 = link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page)
9 9 %small (#{wiki_page.format})
10 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 17 %hr
18 18  
19 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 20 = link_to user_snippets_path(snippet.author) do
21 21 = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: ''
22 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)}
... ...