Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-03-02 14:33:55 +0300
committerPhil Hughes <me@iamphill.com>2016-03-10 11:39:47 +0300
commit3d99ffc862b76c4dcc560aa8d8f4f9c1b7dd3f81 (patch)
tree7e6d6beaaece6348c9c1a5bac60505be914da016 /app/helpers/application_helper.rb
parent491ac7ce4b79c901e23799d2062f9f013f08c6c3 (diff)
Edited timeago text on comments
Unified the 'edited text' to be the same in descriptions and comments Closes #5538
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb30
1 files changed, 23 insertions, 7 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 368969c6472..cc4d2a8877d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -182,20 +182,36 @@ module ApplicationHelper
# Returns an HTML-safe String
def time_ago_with_tooltip(time, placement: 'top', html_class: 'time_ago', skip_js: false)
element = content_tag :time, time.to_s,
- class: "#{html_class} js-timeago js-timeago-pending",
+ class: "#{html_class} js-timeago",
datetime: time.to_time.getutc.iso8601,
title: time.in_time_zone.to_s(:medium),
data: { toggle: 'tooltip', placement: placement, container: 'body' }
- unless skip_js
- element << javascript_tag(
- "$('.js-timeago-pending').removeClass('js-timeago-pending').timeago()"
- )
- end
-
element
end
+ def edited_time_ago_with_tooltip(object, placement: 'top', html_class: 'time_ago', skip_js: false, include_author: false)
+ return nil if object.updated_at == object.created_at
+
+ content_tag :small, class: "edited-text" do
+ output = content_tag :span do
+ "Edited "
+ end
+ output += time_ago_with_tooltip(object.updated_at)
+
+ if include_author
+ if object.updated_by && object.updated_by != object.author
+ output += content_tag :span do
+ " by "
+ end
+ output += link_to_member(object.project, object.updated_by, avatar: false, author_class: nil)
+ end
+ end
+
+ output
+ end
+ end
+
def render_markup(file_name, file_content)
if gitlab_markdown?(file_name)
Haml::Helpers.preserve(markdown(file_content))