summaryrefslogtreecommitdiff
path: root/app/helpers/commits_helper.rb
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-06-15 20:24:13 +0000
committerJacob Schatz <jschatz@gitlab.com>2016-06-15 20:24:13 +0000
commit5444db293cce286f0d14cb54a9ead7efdd7db13a (patch)
tree61039750eb1ba494f90e4c0620fa0c305b0c59ca /app/helpers/commits_helper.rb
parent5f22603b3f83e905df86d2e90b5803711497e21c (diff)
parent1f192afa2abab5fcab693eaf3e0fa3c874cfb793 (diff)
downloadgitlab-ce-5444db293cce286f0d14cb54a9ead7efdd7db13a.tar.gz
Merge branch 'commits-ui' into 'master'
Updated commits UI Closes #14633 See merge request !4271
Diffstat (limited to 'app/helpers/commits_helper.rb')
-rw-r--r--app/helpers/commits_helper.rb24
1 files changed, 16 insertions, 8 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index 493505e0c95..474041eccbb 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -16,6 +16,16 @@ module CommitsHelper
commit_person_link(commit, options.merge(source: :committer))
end
+ def commit_author_avatar(commit, options = {})
+ options = options.merge(source: :author)
+ user = commit.send(options[:source])
+
+ source_email = clean(commit.send "#{options[:source]}_email".to_sym)
+ person_email = user.try(:email) || source_email
+
+ image_tag(avatar_icon(person_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]} hidden-xs", width: options[:size], alt: "")
+ end
+
def image_diff_class(diff)
if diff.deleted_file
"deleted"
@@ -102,24 +112,24 @@ module CommitsHelper
if current_controller?(:projects, :commits)
if @repo.blob_at(commit.id, @path)
return link_to(
- "Browse File »",
+ "Browse File",
namespace_project_blob_path(project.namespace, project,
tree_join(commit.id, @path)),
- class: "pull-right"
+ class: "btn btn-default"
)
elsif @path.present?
return link_to(
- "Browse Directory »",
+ "Browse Directory",
namespace_project_tree_path(project.namespace, project,
tree_join(commit.id, @path)),
- class: "pull-right"
+ class: "btn btn-default"
)
end
end
link_to(
"Browse Files",
namespace_project_tree_path(project.namespace, project, commit),
- class: "pull-right"
+ class: "btn btn-default"
)
end
@@ -187,12 +197,10 @@ module CommitsHelper
source_email = clean(commit.send "#{options[:source]}_email".to_sym)
person_name = user.try(:name) || source_name
- person_email = user.try(:email) || source_email
text =
if options[:avatar]
- avatar = image_tag(avatar_icon(person_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "")
- %Q{#{avatar} <span class="commit-#{options[:source]}-name">#{person_name}</span>}
+ %Q{<span class="commit-#{options[:source]}-name">#{person_name}</span>}
else
person_name
end