summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-16 13:21:37 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-16 13:21:37 +0000
commite10f5f4f56b071f4ab456451780c4bdff942e9c4 (patch)
treed254b39b1ad4287bba59f7bdd76eb0f98f55db02
parent0c2df939dff145eda4e2fe4a292793cb9571799b (diff)
parent47e17103f589b51aa2f6267f56a67c1eb400054f (diff)
downloadgitlab-ce-e10f5f4f56b071f4ab456451780c4bdff942e9c4.tar.gz
Merge branch 'last-commit-project-page' into 'master'
Show last commit from default branch on project home page Implements #2705 Screenshot: ![Screenshot_2015-10-15_19.03.29](https://gitlab.com/gitlab-org/gitlab-ce/uploads/ef1cfa6764ab0ec5e7584ae61980a47d/Screenshot_2015-10-15_19.03.29.png) Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> cc @skyruler See merge request !1610
-rw-r--r--CHANGELOG3
-rw-r--r--app/assets/stylesheets/framework/blocks.scss5
-rw-r--r--app/assets/stylesheets/pages/projects.scss31
-rw-r--r--app/views/projects/_last_commit.html.haml12
-rw-r--r--app/views/projects/show.html.haml4
-rw-r--r--features/project/project.feature6
-rw-r--r--features/steps/shared/project.rb7
7 files changed, 68 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 814a6772cfd..ea9f55ad08e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
Please view this file on the master branch, on stable branches it's out of date.
+v 8.2.0 (unreleased)
+ - Show last project commit to default branch on project home page
+
v 8.1.0 (unreleased)
- Fix error preventing displaying of commit data for a directory with a leading dot (Stan Hu)
- Speed up load times of issue detail pages by roughly 1.5x
diff --git a/app/assets/stylesheets/framework/blocks.scss b/app/assets/stylesheets/framework/blocks.scss
index 6ce34b5c3e8..32d219d4d60 100644
--- a/app/assets/stylesheets/framework/blocks.scss
+++ b/app/assets/stylesheets/framework/blocks.scss
@@ -18,6 +18,7 @@
line-height: 36px;
}
+.content-block,
.gray-content-block {
margin: -$gl-padding;
background-color: $background-color;
@@ -27,6 +28,10 @@
border-bottom: 1px solid $border-color;
color: $gl-gray;
+ &.white {
+ background-color: white;
+ }
+
&.top-block {
border-top: none;
}
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss
index f7a22849003..0dddb6b6ed4 100644
--- a/app/assets/stylesheets/pages/projects.scss
+++ b/app/assets/stylesheets/pages/projects.scss
@@ -511,3 +511,34 @@ pre.light-well {
margin-top: -1px;
}
}
+
+.project-last-commit {
+ margin: 0 7px;
+
+ .ci-status {
+ margin-right: 16px;
+ }
+
+ .commit-row-message {
+ color: $gl-gray;
+ }
+
+ .commit_short_id {
+ margin-right: 5px;
+ color: $gl-link-color;
+ font-weight: 600;
+ }
+
+ .commit-author-link {
+ margin-left: 7px;
+ text-decoration: none;
+ .avatar {
+ float: none;
+ margin-right: 4px;
+ }
+
+ .commit-author-name {
+ font-weight: 600;
+ }
+ }
+}
diff --git a/app/views/projects/_last_commit.html.haml b/app/views/projects/_last_commit.html.haml
new file mode 100644
index 00000000000..d7b20bfc6b1
--- /dev/null
+++ b/app/views/projects/_last_commit.html.haml
@@ -0,0 +1,12 @@
+.project-last-commit
+ - ci_commit = project.ci_commit(commit.sha)
+ - if ci_commit
+ = link_to ci_status_path(ci_commit), class: "ci-status ci-#{ci_commit.status}" do
+ = ci_status_icon(ci_commit)
+ = ci_commit.status
+
+ = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id"
+ = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message"
+ &middot;
+ #{time_ago_with_tooltip(commit.committed_date, skip_js: true)} by
+ = commit_author_link(commit, avatar: true, size: 24)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index e95d987d74c..e20b1fc49c0 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -64,6 +64,10 @@
= icon("exclamation-triangle fw")
Archived project! Repository is read-only
+- if @repository.commit
+ .content-block.second-block.white
+ = render 'projects/last_commit', commit: @repository.commit, project: @project
+
%section
- if prefer_readme?
.project-show-readme
diff --git a/features/project/project.feature b/features/project/project.feature
index b3fb0794547..1a53945eb04 100644
--- a/features/project/project.feature
+++ b/features/project/project.feature
@@ -31,6 +31,12 @@ Feature: Project
And I visit project "Shop" page
Then I should see project "Shop" README
+ Scenario: I should see last commit with CI
+ Given project "Shop" has CI enabled
+ Given project "Shop" has CI build
+ And I visit project "Shop" page
+ And I should see last commit with CI status
+
@javascript
Scenario: I should see project activity
When I visit project "Shop" activity page
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb
index 5744e455ebd..7021fac5fe4 100644
--- a/features/steps/shared/project.rb
+++ b/features/steps/shared/project.rb
@@ -206,4 +206,11 @@ module SharedProject
project = Project.find_by(name: "Shop")
create :ci_commit, gl_project: project, sha: project.commit.sha
end
+
+ step 'I should see last commit with CI status' do
+ page.within ".project-last-commit" do
+ expect(page).to have_content(project.commit.sha[0..6])
+ expect(page).to have_content("skipped")
+ end
+ end
end