submodules displayed for tree view

This commit is contained in:
Dmitriy Zaporozhets 2012-02-14 23:48:42 +02:00
parent c062e56b4c
commit a7bcc2eb5c
8 changed files with 38 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

View file

@ -234,12 +234,19 @@ img.lil_av {
border-color:#ddd; border-color:#ddd;
h5 { h5 {
padding: 5px 10px; padding: 0 10px;
background:#f5f5f5; background:#f5f5f5;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
@include round-borders-top(4px);
border-top:none;
} }
li { li {
padding:10px; padding:10px;
&:first-child {
@include round-borders-top(4px);
border-top:none;
}
} }
} }

View file

@ -144,3 +144,7 @@ table.highlighttable .linenodiv pre {
background:#f5f5f5; background:#f5f5f5;
} }
} }
.tree-commit-link {
color:#333;
}

View file

@ -28,6 +28,7 @@ class CommitsController < ApplicationController
@notes = project.commit_notes(@commit).fresh.limit(20) @notes = project.commit_notes(@commit).fresh.limit(20)
@note = @project.build_commit_note(@commit) @note = @project.build_commit_note(@commit)
@comments_allowed = true
@line_notes = project.commit_line_notes(@commit) @line_notes = project.commit_line_notes(@commit)
respond_to do |format| respond_to do |format|

View file

@ -8,12 +8,14 @@
- else - else
%td.old_line %td.old_line
= link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", :id => line_code = link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", :id => line_code
= link_to "", "#", :class => "line_note_link", "line_code" => line_code, :title => "Add note for this line" - if @comments_allowed
= link_to "", "#", :class => "line_note_link", "line_code" => line_code, :title => "Add note for this line"
%td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", :id => line_code %td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", :id => line_code
%td.line_content{:class => "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} &nbsp;" %td.line_content{:class => "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} &nbsp;"
- comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse - if @comments_allowed
- unless comments.empty? - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse
- comments.each do |note| - unless comments.empty?
= render "notes/per_line_show", :note => note - comments.each do |note|
- @line_notes.reject!{ |n| n == note } = render "notes/per_line_show", :note => note
- @line_notes.reject!{ |n| n == note }

View file

@ -0,0 +1,13 @@
- url = content.url(@ref)
- name = content.basename
- return unless url
%tr{ :class => "tree-item", :url => url }
%td.tree-item-file-name
= image_tag "submodule.png"
%strong= truncate(name, :length => 40)
%td
%code= content.id[0..10]
%td
= link_to truncate(url, :length => 40), url

View file

@ -39,6 +39,8 @@
= render :partial => "refs/tree_item", :locals => { :content => content } = render :partial => "refs/tree_item", :locals => { :content => content }
- contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content| - contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content|
= render :partial => "refs/tree_item", :locals => { :content => content } = render :partial => "refs/tree_item", :locals => { :content => content }
- contents.select{ |i| i.is_a?(Grit::Submodule)}.each do |content|
= render :partial => "refs/submodule_item", :locals => { :content => content }
- if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first - if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first
#tree-readme-holder #tree-readme-holder

View file

@ -15,4 +15,4 @@
- tm = @project.team_member_by_name_or_email(content_commit.author_email, content_commit.author_name) - tm = @project.team_member_by_name_or_email(content_commit.author_email, content_commit.author_name)
- if tm - if tm
= link_to "[#{tm.user_name}]", project_team_member_path(@project, tm) = link_to "[#{tm.user_name}]", project_team_member_path(@project, tm)
= link_to truncate(content_commit.safe_message, :length => tm ? 20 : 40), project_commit_path(@project, content_commit.id), :class => "tree-commit-link" = link_to truncate(content_commit.safe_message, :length => tm ? 30 : 50), project_commit_path(@project, content_commit.id), :class => "tree-commit-link"