summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-11-12 15:18:56 +0200
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-11-12 15:18:56 +0200
commit4dd5d9c8cce5c596a159277c464026cf0f50f1c4 (patch)
tree1383f4dde7ceee3a94e7eaf4d86b756aafe4cbbe
parentc1c64d985ec66433b9e990c5595997850727d8aa (diff)
downloadgitlab-ce-4dd5d9c8cce5c596a159277c464026cf0f50f1c4.tar.gz
Issue #185 – Show branch name for commits on activities & dashboard pages
-rw-r--r--app/assets/stylesheets/projects.css.scss8
-rw-r--r--app/models/repository.rb4
-rw-r--r--app/views/dashboard/index.html.haml2
-rw-r--r--app/views/layouts/project.html.haml2
-rw-r--r--app/views/projects/_recent_commits.html.haml4
-rw-r--r--lib/commit_ext.rb2
-rw-r--r--spec/requests/dashboard_spec.rb1
-rw-r--r--spec/requests/projects_spec.rb9
8 files changed, 25 insertions, 7 deletions
diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss
index 1a9ab673a95..c94e7934ba3 100644
--- a/app/assets/stylesheets/projects.css.scss
+++ b/app/assets/stylesheets/projects.css.scss
@@ -344,4 +344,12 @@ body.project-page table .commit {
background: #2c5c66;
color:white;
}
+ &.issue {
+ background: #D12F19;
+ color:white;
+ }
+ &.commit {
+ background: #2c5c66;
+ color:white;
+ }
}
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 3b09471596c..5a2b71a4c5e 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -73,7 +73,7 @@ class Repository
def fresh_commits(n = 10)
commits = heads.map do |h|
- repo.commits(h.name, n)
+ repo.commits(h.name, n).each { |c| c.head = h }
end.flatten.uniq { |c| c.id }
commits.sort! do |x, y|
@@ -85,7 +85,7 @@ class Repository
def commits_since(date)
commits = heads.map do |h|
- repo.log(h.name, nil, :since => date)
+ repo.log(h.name, nil, :since => date).each { |c| c.head = h }
end.flatten.uniq { |c| c.id }
commits.sort! do |x, y|
diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml
index e7559dd5762..a8b7f2538d3 100644
--- a/app/views/dashboard/index.html.haml
+++ b/app/views/dashboard/index.html.haml
@@ -27,6 +27,8 @@
%a.project-update{:href => dashboard_feed_path(project, update)}
= image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
%span.update-title
+ - if update.kind_of?(Grit::Commit)
+ %span.tag.commit= update.head.name
= dashboard_feed_title(update)
%span.update-author
%strong= update.author_name
diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml
index 078f710c6c6..48b4360f687 100644
--- a/app/views/layouts/project.html.haml
+++ b/app/views/layouts/project.html.haml
@@ -19,7 +19,7 @@
.git_url_wrapper
%input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo, :class => "one_click_select"}
%aside
- = link_to "History", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
+ = link_to "Activities", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
= link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil
= link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil
= link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do
diff --git a/app/views/projects/_recent_commits.html.haml b/app/views/projects/_recent_commits.html.haml
index 7dfc1971213..9680eb52208 100644
--- a/app/views/projects/_recent_commits.html.haml
+++ b/app/views/projects/_recent_commits.html.haml
@@ -22,7 +22,9 @@
- else
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
.title
- %p= link_to truncate(commit.safe_message, :length => 40), project_commit_path(@project, :id => commit.id)
+ %p
+ %span.tag.commit= commit.head.name
+ = link_to truncate(commit.safe_message, :length => 40), project_commit_path(@project, :id => commit.id)
%span
%span.author
diff --git a/lib/commit_ext.rb b/lib/commit_ext.rb
index db6503557ae..2850a239544 100644
--- a/lib/commit_ext.rb
+++ b/lib/commit_ext.rb
@@ -1,4 +1,6 @@
module CommitExt
+ attr_accessor :head
+
def safe_message
message.encode("UTF-8",
:invalid => :replace,
diff --git a/spec/requests/dashboard_spec.rb b/spec/requests/dashboard_spec.rb
index 6940366af41..d54c6154b55 100644
--- a/spec/requests/dashboard_spec.rb
+++ b/spec/requests/dashboard_spec.rb
@@ -22,6 +22,7 @@ describe "Dashboard" do
it "should have news feed" do
within "#news-feed" do
+ page.should have_content("master")
page.should have_content(@project.commit.author.name)
page.should have_content(@project.commit.safe_message)
end
diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb
index 3d8971579b9..87f76fdb3a7 100644
--- a/spec/requests/projects_spec.rb
+++ b/spec/requests/projects_spec.rb
@@ -72,10 +72,13 @@ describe "Projects" do
current_path.should == project_path(@project)
end
- it "should beahave like dashboard" do
- page.should have_content("History")
+ it "should beahave like activities page" do
+ within ".commit" do
+ page.should have_content("master")
+ page.should have_content(@project.commit.author.name)
+ page.should have_content(@project.commit.safe_message)
+ end
end
-
end
describe "GET /projects/team" do