Commit 8170da06a6eb55bfe02fa9e3541b89e5a44ae4a4

Authored by Dmitriy Zaporozhets
2 parents 121f6d04 e29a2566

Merge branch 'dev' into gh_master

app/assets/stylesheets/projects.css.scss
@@ -667,6 +667,15 @@ table.highlighttable pre{ @@ -667,6 +667,15 @@ table.highlighttable pre{
667 .cred { color:#D12F19; } 667 .cred { color:#D12F19; }
668 .cgreen { color:#44aa22; } 668 .cgreen { color:#44aa22; }
669 669
  670 +body.project-page table .commit {
  671 + a.tree-commit-link {
  672 + color:gray;
  673 + &:hover {
  674 + text-decoration:underline;
  675 + }
  676 + }
  677 +}
  678 +
670 body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;} 679 body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
671 body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;} 680 body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
672 body.project-page #notes-list .note img{float: left; margin-right: 10px;} 681 body.project-page #notes-list .note img{float: left; margin-right: 10px;}
app/helpers/application_helper.rb
@@ -4,6 +4,10 @@ module ApplicationHelper @@ -4,6 +4,10 @@ module ApplicationHelper
4 "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon" 4 "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon"
5 end 5 end
6 6
  7 + def fixed_mode?
  8 + @view_mode == :fixed
  9 + end
  10 +
7 def body_class(default_class = nil) 11 def body_class(default_class = nil)
8 main = content_for(:body_class).blank? ? 12 main = content_for(:body_class).blank? ?
9 default_class : 13 default_class :
app/models/project.rb
@@ -50,6 +50,11 @@ class Project < ActiveRecord::Base @@ -50,6 +50,11 @@ class Project < ActiveRecord::Base
50 code 50 code
51 end 51 end
52 52
  53 + def team_member_by_name_or_email(email = nil, name = nil)
  54 + user = users.where("email like ? or name like ?", email, name).first
  55 + users_projects.find_by_user_id(user.id) if user
  56 + end
  57 +
53 def common_notes 58 def common_notes
54 notes.where(:noteable_type => ["", nil]) 59 notes.where(:noteable_type => ["", nil])
55 end 60 end
app/views/commits/_commits.html.haml
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" 17 = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
18 %span.commit-title 18 %span.commit-title
19 %strong 19 %strong
20 - = truncate(commit.safe_message, :length => 60) 20 + = truncate(commit.safe_message, :length => fixed_mode? ? 60 : 120)
21 %span.commit-author 21 %span.commit-author
22 %strong= commit.author_name 22 %strong= commit.author_name
23 = time_ago_in_words(commit.committed_date) 23 = time_ago_in_words(commit.committed_date)
app/views/layouts/project.html.haml
@@ -16,29 +16,29 @@ @@ -16,29 +16,29 @@
16 .project-container 16 .project-container
17 .project-sidebar 17 .project-sidebar
18 .fixed 18 .fixed
19 - %input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo}  
20 - %aside  
21 - = link_to "History", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil  
22 - = link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil  
23 - = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil  
24 - = link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do  
25 - Team  
26 - - if @project.users_projects.count > 0  
27 - %span{ :class => "number" }= @project.users_projects.count  
28 - = link_to project_issues_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do  
29 - Issues  
30 - - if @project.issues.opened.count > 0  
31 - %span{ :class => "number" }= @project.issues.opened.count  
32 - = link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do  
33 - Wall  
34 - - if @project.common_notes.count > 0  
35 - %span{ :class => "number" }= @project.common_notes.count  
36 - = link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do  
37 - Snippets  
38 - - if @project.snippets.count > 0  
39 - %span{ :class => "number" }= @project.snippets.non_expired.count  
40 - - if @commit  
41 - = link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil 19 + %input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo, :class => "one_click_select"}
  20 + %aside
  21 + = link_to "History", project_path(@project), :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
  22 + = link_to "Tree", tree_project_path(@project), :class => current_page?(:controller => "projects", :action => "tree", :id => @project) ? "current" : nil
  23 + = link_to "Commits", project_commits_path(@project), :class => current_page?(:controller => "commits", :action => "index", :project_id => @project) ? "current" : nil
  24 + = link_to team_project_path(@project), :class => (current_page?(:controller => "projects", :action => "team", :id => @project) || controller.controller_name == "team_members") ? "current" : nil do
  25 + Team
  26 + - if @project.users_projects.count > 0
  27 + %span{ :class => "number" }= @project.users_projects.count
  28 + = link_to project_issues_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
  29 + Issues
  30 + - if @project.issues.opened.count > 0
  31 + %span{ :class => "number" }= @project.issues.opened.count
  32 + = link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do
  33 + Wall
  34 + - if @project.common_notes.count > 0
  35 + %span{ :class => "number" }= @project.common_notes.count
  36 + = link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do
  37 + Snippets
  38 + - if @project.snippets.count > 0
  39 + %span{ :class => "number" }= @project.snippets.non_expired.count
  40 + - if @commit
  41 + = link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil
42 42
43 .project-content 43 .project-content
44 = yield 44 = yield
app/views/projects/_tree_item.html.haml
@@ -11,5 +11,8 @@ @@ -11,5 +11,8 @@
11 %td 11 %td
12 = time_ago_in_words(content_commit.committed_date) 12 = time_ago_in_words(content_commit.committed_date)
13 ago 13 ago
14 - %td  
15 - = link_to truncate(content_commit.safe_message, :length => 40), project_commit_path(@project, content_commit) 14 + %td.commit
  15 + = link_to truncate(content_commit.safe_message, :length => fixed_mode? ? 40 : 80), project_commit_path(@project, content_commit), :class => "tree-commit-link"
  16 + - tm = @project.team_member_by_name_or_email(content_commit.author_email, content_commit.author_name)
  17 + - if tm
  18 + = link_to "[#{tm.user_name}]", project_team_member_path(@project, tm)