Commit 9a3d6659 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Show last commit for Blob#show

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 35fb7d54
...@@ -133,3 +133,21 @@ ...@@ -133,3 +133,21 @@
color: #777; color: #777;
} }
} }
.blob-commit-info {
list-style: none;
margin: 0;
padding: 0;
margin-bottom: 10px;
.commit {
.commit-row-title {
font-size: 13px;
.commit-row-message {
font-weight: normal;
color: #555;
}
}
}
}
...@@ -34,7 +34,7 @@ class Projects::RefsController < Projects::ApplicationController ...@@ -34,7 +34,7 @@ class Projects::RefsController < Projects::ApplicationController
contents = tree.entries contents = tree.entries
@logs = contents.map do |content| @logs = contents.map do |content|
file = params[:path] ? File.join(params[:path], content.name) : content.name file = params[:path] ? File.join(params[:path], content.name) : content.name
last_commit = @repo.commits(@commit.id, file, 1).last last_commit = @repo.last_commit_for_path(@commit.id, file)
{ {
file_name: content.name, file_name: content.name,
commit: last_commit commit: last_commit
......
...@@ -204,4 +204,8 @@ class Repository ...@@ -204,4 +204,8 @@ class Repository
end end
end end
end end
def last_commit_for_path(sha, path)
commits(sha, path, 1).last
end
end end
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
- else - else
= link_to title, '#' = link_to title, '#'
%ul.blob-commit-info.bs-callout.bs-callout-info
- blob_commit = @repository.last_commit_for_path(@commit.id, @blob.path)
= render blob_commit, project: @project
%div#tree-content-holder.tree-content-holder %div#tree-content-holder.tree-content-holder
.file-holder .file-holder
.file-title .file-title
......
%div.tree-ref-holder %div.tree-ref-holder
= render 'shared/ref_switcher', destination: 'blob', path: @path = render 'shared/ref_switcher', destination: 'blob', path: @path
%div#tree-holder.tree-holder %div#tree-holder.tree-holder
= render 'blob', blob: @blob = render 'blob', blob: @blob
......
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