diff options
author | Robert Speicher <robert@gitlab.com> | 2016-03-17 20:35:06 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-03-17 20:35:06 +0000 |
commit | dc396d0fa4b18815b4517c23b0d4e50c23b20db7 (patch) | |
tree | e0c025eefa0e4ac7f4f82a4827f2d4e045a90f77 /app/helpers/application_helper.rb | |
parent | ab9970e22c7d68fd2338f0fa1a5cf3ad3ad4457b (diff) | |
parent | 2941a76fe0fa5305bd6e31e6c47477732e3e7cec (diff) | |
download | gitlab-ce-dc396d0fa4b18815b4517c23b0d4e50c23b20db7.tar.gz |
Merge branch 'edited-text' into 'master'
Edited timeago text on comments
Unified the 'edited text' to be the same in descriptions and comments
Closes #5538
See merge request !3063
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d1b1c61b710..883c2871746 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -182,7 +182,7 @@ 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 #{"js-timeago-pending" unless skip_js}", datetime: time.to_time.getutc.iso8601, title: time.in_time_zone.to_s(:medium), data: { toggle: 'tooltip', placement: placement, container: 'body' } @@ -196,6 +196,22 @@ module ApplicationHelper element end + def edited_time_ago_with_tooltip(object, placement: 'top', html_class: 'time_ago', include_author: false) + return if object.updated_at == object.created_at + + content_tag :small, class: "edited-text" do + output = content_tag(:span, "Edited ") + output << time_ago_with_tooltip(object.updated_at, placement: placement, html_class: html_class) + + if include_author && object.updated_by && object.updated_by != object.author + output << content_tag(:span, " by ") + output << link_to_member(object.project, object.updated_by, avatar: false, author_class: nil) + end + + output + end + end + def render_markup(file_name, file_content) if gitlab_markdown?(file_name) Haml::Helpers.preserve(markdown(file_content)) |