Commit a2355c52 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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

parents 24820d5e 9a31844e
...@@ -81,6 +81,7 @@ $ -> ...@@ -81,6 +81,7 @@ $ ->
$(@).parents('form').submit() $(@).parents('form').submit()
$("abbr.timeago").timeago() $("abbr.timeago").timeago()
$('.js-timeago').timeago()
# Flash # Flash
if (flash = $(".flash-container")).length > 0 if (flash = $(".flash-container")).length > 0
......
...@@ -72,7 +72,7 @@ module ApplicationHelper ...@@ -72,7 +72,7 @@ module ApplicationHelper
def last_commit(project) def last_commit(project)
if project.repo_exists? if project.repo_exists?
time_ago_with_tooltip(project.repository.commit.committed_date) + " ago" time_ago_with_tooltip(project.repository.commit.committed_date)
else else
"Never" "Never"
end end
...@@ -210,11 +210,11 @@ module ApplicationHelper ...@@ -210,11 +210,11 @@ module ApplicationHelper
def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago') def time_ago_with_tooltip(date, placement = 'top', html_class = 'time_ago')
capture_haml do capture_haml do
haml_tag :time, time_ago_in_words(date), haml_tag :time, date.to_s,
class: html_class, datetime: date, title: date.stamp("Aug 21, 2011 9:23pm"), class: html_class, datetime: date.getutc.iso8601, title: date.stamp("Aug 21, 2011 9:23pm"),
data: { toggle: 'tooltip', placement: placement } data: { toggle: 'tooltip', placement: placement }
haml_tag :script, "$('." + html_class + "').tooltip()" haml_tag :script, "$('." + html_class + "').timeago().tooltip()"
end.html_safe end.html_safe
end end
end end
...@@ -23,11 +23,11 @@ module NotesHelper ...@@ -23,11 +23,11 @@ module NotesHelper
def note_timestamp(note) def note_timestamp(note)
# Shows the created at time and the updated at time if different # Shows the created at time and the updated at time if different
ts = "#{time_ago_with_tooltip(note.created_at, 'bottom', 'note_created_ago')} ago" ts = "#{time_ago_with_tooltip(note.created_at, 'bottom', 'note_created_ago')}"
if note.updated_at != note.created_at if note.updated_at != note.created_at
ts << capture_haml do ts << capture_haml do
haml_tag :small do haml_tag :small do
haml_concat " (Edited #{time_ago_with_tooltip(note.updated_at, 'bottom', 'note_edited_ago')} ago)" haml_concat " (Edited #{time_ago_with_tooltip(note.updated_at, 'bottom', 'note_edited_ago')})"
end end
end end
end end
......
...@@ -190,7 +190,7 @@ module ProjectsHelper ...@@ -190,7 +190,7 @@ module ProjectsHelper
def project_last_activity(project) def project_last_activity(project)
if project.last_activity_at if project.last_activity_at
time_ago_with_tooltip(project.last_activity_at, 'bottom', 'last_activity_time_ago') + " ago" time_ago_with_tooltip(project.last_activity_at, 'bottom', 'last_activity_time_ago')
else else
"Never" "Never"
end end
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
%p %p
= link_to project.name_with_namespace, [:admin, project] = link_to project.name_with_namespace, [:admin, project]
%span.light.pull-right %span.light.pull-right
#{time_ago_with_tooltip(project.created_at)} ago #{time_ago_with_tooltip(project.created_at)}
.span4 .span4
%h4 Latest users %h4 Latest users
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
= link_to [:admin, user] do = link_to [:admin, user] do
= user.name = user.name
%span.light.pull-right %span.light.pull-right
#{time_ago_with_tooltip(user.created_at)} ago #{time_ago_with_tooltip(user.created_at)}
.span4 .span4
%h4 Latest groups %h4 Latest groups
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
= link_to [:admin, group] do = link_to [:admin, group] do
= group.name = group.name
%span.light.pull-right %span.light.pull-right
#{time_ago_with_tooltip(group.created_at)} ago #{time_ago_with_tooltip(group.created_at)}
%br %br
.row .row
......
- if event.proper? - if event.proper?
.event-item{class: "#{event.body? ? "event-block" : "event-inline" }"} .event-item{class: "#{event.body? ? "event-block" : "event-inline" }"}
%span.cgray.pull-right %span.cgray.pull-right
#{time_ago_with_tooltip(event.created_at)} ago #{time_ago_with_tooltip(event.created_at)}
= cache event do = cache event do
= image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:'' = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:''
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
%strong= truncate(event.ref_name, length: 28) %strong= truncate(event.ref_name, length: 28)
at at
%strong= link_to_project event.project %strong= link_to_project event.project
#{time_ago_with_tooltip(event.created_at)} ago #{time_ago_with_tooltip(event.created_at)}
.pull-right .pull-right
= link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-create btn-small" do = link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-create btn-small" do
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
%span %span
(#{key.fingerprint}) (#{key.fingerprint})
%span.cgray %span.cgray
added #{time_ago_with_tooltip(key.created_at)} ago added #{time_ago_with_tooltip(key.created_at)}
= link_to 'Remove', profile_key_path(key), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-small btn-remove delete-key pull-right" = link_to 'Remove', profile_key_path(key), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-small btn-remove delete-key pull-right"
...@@ -27,4 +27,4 @@ ...@@ -27,4 +27,4 @@
= image_tag avatar_icon(commit.author_email), class: "avatar s16", alt: '' = image_tag avatar_icon(commit.author_email), class: "avatar s16", alt: ''
%span.light %span.light
= gfm escape_once(truncate(commit.title, length: 40)) = gfm escape_once(truncate(commit.title, length: 40))
#{time_ago_with_tooltip(commit.committed_date)} ago #{time_ago_with_tooltip(commit.committed_date)}
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
%span.light Authored by %span.light Authored by
%strong %strong
= commit_author_link(@commit, avatar: true, size: 24) = commit_author_link(@commit, avatar: true, size: 24)
#{time_ago_with_tooltip(@commit.authored_date)} ago #{time_ago_with_tooltip(@commit.authored_date)}
- if @commit.different_committer? - if @commit.different_committer?
.commit-info-row .commit-info-row
%span.light Committed by %span.light Committed by
%strong %strong
= commit_committer_link(@commit, avatar: true, size: 24) = commit_committer_link(@commit, avatar: true, size: 24)
#{time_ago_with_tooltip(@commit.committed_date)} ago #{time_ago_with_tooltip(@commit.committed_date)}
.commit-info-row .commit-info-row
%span.cgray= pluralize(@commit.parents.count, "parent") %span.cgray= pluralize(@commit.parents.count, "parent")
......
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
.commit-row-info .commit-row-info
= commit_author_link(commit, avatar: true, size: 16) = commit_author_link(commit, avatar: true, size: 16)
.committed_ago .committed_ago
#{time_ago_with_tooltip(commit.committed_date)} ago &nbsp; #{time_ago_with_tooltip(commit.committed_date)} &nbsp;
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
= link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id" = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id"
&nbsp; &nbsp;
= link_to_gfm truncate(commit.title, length: 40), project_commit_path(project, commit.id), class: "commit-row-message" = link_to_gfm truncate(commit.title, length: 40), project_commit_path(project, commit.id), class: "commit-row-message"
#{time_ago_with_tooltip(commit.committed_date)} ago &nbsp; #{time_ago_with_tooltip(commit.committed_date)} &nbsp;
...@@ -21,4 +21,4 @@ ...@@ -21,4 +21,4 @@
- deploy_key.projects.map(&:name_with_namespace).each do |project_name| - deploy_key.projects.map(&:name_with_namespace).each do |project_name|
%span.label.label-gray.deploy-project-label= project_name %span.label.label-gray.deploy-project-label= project_name
%small.pull-right %small.pull-right
Created #{time_ago_with_tooltip(deploy_key.created_at)} ago Created #{time_ago_with_tooltip(deploy_key.created_at)}
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
%i.icon-time %i.icon-time
= issue.milestone.title = issue.milestone.title
.pull-right .pull-right
%small updated #{time_ago_with_tooltip(issue.updated_at, 'bottom', 'issue_update_ago')} ago %small updated #{time_ago_with_tooltip(issue.updated_at, 'bottom', 'issue_update_ago')}
.issue-labels .issue-labels
- issue.labels.each do |label| - issue.labels.each do |label|
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Issue ##{@issue.iid} Issue ##{@issue.iid}
%small %small
created #{time_ago_with_tooltip(@issue.created_at)} ago created #{time_ago_with_tooltip(@issue.created_at)}
- if @issue.closed? - if @issue.closed?
%span.state-label.state-label-red Closed %span.state-label.state-label-red Closed
......
...@@ -34,4 +34,4 @@ ...@@ -34,4 +34,4 @@
.pull-right .pull-right
%small updated #{time_ago_with_tooltip(merge_request.updated_at, 'bottom', 'merge_request_updated_ago')} ago %small updated #{time_ago_with_tooltip(merge_request.updated_at, 'bottom', 'merge_request_updated_ago')}
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
%span %span
%i.icon-remove %i.icon-remove
Closed by #{link_to_member(@project, @merge_request.closed_event.author)} Closed by #{link_to_member(@project, @merge_request.closed_event.author)}
#{time_ago_with_tooltip(@merge_request.closed_event.created_at)} ago. #{time_ago_with_tooltip(@merge_request.closed_event.created_at)}.
- if @merge_request.merged? - if @merge_request.merged?
.description.alert-success .description.alert-success
%span %span
%i.icon-ok %i.icon-ok
Merged by #{link_to_member(@project, @merge_request.merge_event.author)} Merged by #{link_to_member(@project, @merge_request.merge_event.author)}
#{time_ago_with_tooltip(@merge_request.merge_event.created_at)} ago. #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}.
- if !@closes_issues.empty? && @merge_request.opened? - if !@closes_issues.empty? && @merge_request.opened?
.description.alert-info .description.alert-info
%span %span
......
%h3.page-title %h3.page-title
= "Merge Request ##{@merge_request.iid}" = "Merge Request ##{@merge_request.iid}"
%small %small
created #{time_ago_with_tooltip(@merge_request.created_at)} ago created #{time_ago_with_tooltip(@merge_request.created_at)}
- if @merge_request.merged? - if @merge_request.merged?
%span.state-label.state-label-green %span.state-label.state-label-green
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
last updated by last updated by
= link_to_member(@project, last_note.author, avatar: false) = link_to_member(@project, last_note.author, avatar: false)
%span.discussion-last-update %span.discussion-last-update
#{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')} ago #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')}
.discussion-body .discussion-body
- if note.for_diff_line? - if note.for_diff_line?
- if note.active? - if note.active?
......
...@@ -46,6 +46,6 @@ ...@@ -46,6 +46,6 @@
= commit.short_id = commit.short_id
%span.light %span.light
= gfm escape_once(truncate(commit.title, length: 40)) = gfm escape_once(truncate(commit.title, length: 40))
#{time_ago_with_tooltip(commit.committed_date)} ago #{time_ago_with_tooltip(commit.committed_date)}
- else - else
(branch was removed from repository) (branch was removed from repository)
...@@ -5,5 +5,5 @@ ...@@ -5,5 +5,5 @@
:plain :plain
var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}"); var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}");
row.find("td.tree_time_ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)} ago'); row.find("td.tree_time_ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)}');
row.find("td.tree_commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}'); row.find("td.tree_commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}');
...@@ -15,5 +15,4 @@ ...@@ -15,5 +15,4 @@
= gfm escape_once(truncate(commit.title, length: 40)) = gfm escape_once(truncate(commit.title, length: 40))
%td %td
%span.pull-right.cgray %span.pull-right.cgray
= time_ago_in_words(commit.committed_date) = time_ago_with_tooltip(commit.committed_date)
ago
...@@ -19,4 +19,4 @@ ...@@ -19,4 +19,4 @@
= image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16" = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16"
= snippet.author_name = snippet.author_name
%span.light %span.light
#{time_ago_with_tooltip(snippet.created_at)} ago #{time_ago_with_tooltip(snippet.created_at)}
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
.pull-right .pull-right
%small.cdark %small.cdark
%i.icon-calendar %i.icon-calendar
#{time_ago_with_tooltip(commit.committed_date)} ago #{time_ago_with_tooltip(commit.committed_date)}
%p.prepend-left-20 %p.prepend-left-20
= link_to commit.short_id(8), project_commit_path(@project, commit), class: "monospace" = link_to commit.short_id(8), project_commit_path(@project, commit), class: "monospace"
&ndash; &ndash;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
%td %td
= commit.title = commit.title
%td %td
#{time_ago_with_tooltip(version.date)} ago #{time_ago_with_tooltip(version.date)}
%td %td
%strong %strong
= @wiki.page.wiki.page(@wiki.page.name, commit.id).try(:format) = @wiki.page.wiki.page(@wiki.page.name, commit.id).try(:format)
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
= link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page) = link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page)
%small (#{wiki_page.format}) %small (#{wiki_page.format})
.pull-right .pull-right
%small Last edited #{time_ago_with_tooltip(wiki_page.commit.created_at)} ago %small Last edited #{time_ago_with_tooltip(wiki_page.commit.created_at)}
...@@ -17,4 +17,4 @@ ...@@ -17,4 +17,4 @@
%hr %hr
.wiki-last-edit-by .wiki-last-edit-by
Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_with_tooltip(@wiki.commit.created_at)} ago Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_with_tooltip(@wiki.commit.created_at)}
...@@ -20,4 +20,4 @@ ...@@ -20,4 +20,4 @@
= link_to user_snippets_path(snippet.author) do = link_to user_snippets_path(snippet.author) do
= image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: '' = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: ''
= snippet.author_name = snippet.author_name
%span.light #{time_ago_with_tooltip(snippet.created_at)} ago %span.light #{time_ago_with_tooltip(snippet.created_at)}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment