summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-10 20:57:43 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-10 20:57:43 +0000
commit1af84f8ceb8cbe5d6ba5704dd94d7593b0a37429 (patch)
tree17fea18f66e3cdf00f33c0f4bdc520d13c8a9921
parent35fb7d54081f21b757de26cb3e2e763a77720d6d (diff)
parent9a3d665919218ebe30fd1b10a70e75db16675bff (diff)
downloadgitlab-ce-1af84f8ceb8cbe5d6ba5704dd94d7593b0a37429.tar.gz
Merge branch 'feature/blob_last_commit' into 'master'
Feature: show last commit for Blob#show Fixes #970
-rw-r--r--app/assets/stylesheets/sections/tree.scss18
-rw-r--r--app/controllers/projects/refs_controller.rb2
-rw-r--r--app/models/repository.rb4
-rw-r--r--app/views/projects/blob/_blob.html.haml4
-rw-r--r--app/views/projects/blob/show.html.haml1
5 files changed, 28 insertions, 1 deletions
diff --git a/app/assets/stylesheets/sections/tree.scss b/app/assets/stylesheets/sections/tree.scss
index dfdcbb59b6b..f72c6607181 100644
--- a/app/assets/stylesheets/sections/tree.scss
+++ b/app/assets/stylesheets/sections/tree.scss
@@ -133,3 +133,21 @@
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;
+ }
+ }
+ }
+}
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index 16621c0371e..7b8026cff9f 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -34,7 +34,7 @@ class Projects::RefsController < Projects::ApplicationController
contents = tree.entries
@logs = contents.map do |content|
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,
commit: last_commit
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 527dff519bd..2c2bf242b94 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -204,4 +204,8 @@ class Repository
end
end
end
+
+ def last_commit_for_path(sha, path)
+ commits(sha, path, 1).last
+ end
end
diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml
index 32ea967105a..e59d970bf46 100644
--- a/app/views/projects/blob/_blob.html.haml
+++ b/app/views/projects/blob/_blob.html.haml
@@ -15,6 +15,10 @@
- else
= 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
.file-holder
.file-title
diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml
index 56220e520f3..69167654c39 100644
--- a/app/views/projects/blob/show.html.haml
+++ b/app/views/projects/blob/show.html.haml
@@ -1,5 +1,6 @@
%div.tree-ref-holder
= render 'shared/ref_switcher', destination: 'blob', path: @path
+
%div#tree-holder.tree-holder
= render 'blob', blob: @blob