Commit a7bcc2eb5ce47a691e2afa3d5e597eb1710600ca
1 parent
c062e56b
Exists in
master
and in
4 other branches
submodules displayed for tree view
Showing
8 changed files
with
38 additions
and
9 deletions
Show diff stats
641 Bytes
app/assets/stylesheets/common.scss
@@ -234,12 +234,19 @@ img.lil_av { | @@ -234,12 +234,19 @@ img.lil_av { | ||
234 | border-color:#ddd; | 234 | border-color:#ddd; |
235 | 235 | ||
236 | h5 { | 236 | h5 { |
237 | - padding: 5px 10px; | 237 | + padding: 0 10px; |
238 | background:#f5f5f5; | 238 | background:#f5f5f5; |
239 | border-bottom: 1px solid #ccc; | 239 | border-bottom: 1px solid #ccc; |
240 | + @include round-borders-top(4px); | ||
241 | + border-top:none; | ||
240 | } | 242 | } |
241 | 243 | ||
242 | li { | 244 | li { |
243 | padding:10px; | 245 | padding:10px; |
246 | + &:first-child { | ||
247 | + @include round-borders-top(4px); | ||
248 | + border-top:none; | ||
249 | + } | ||
244 | } | 250 | } |
251 | + | ||
245 | } | 252 | } |
app/assets/stylesheets/tree.scss
app/controllers/commits_controller.rb
@@ -28,6 +28,7 @@ class CommitsController < ApplicationController | @@ -28,6 +28,7 @@ class CommitsController < ApplicationController | ||
28 | @notes = project.commit_notes(@commit).fresh.limit(20) | 28 | @notes = project.commit_notes(@commit).fresh.limit(20) |
29 | @note = @project.build_commit_note(@commit) | 29 | @note = @project.build_commit_note(@commit) |
30 | 30 | ||
31 | + @comments_allowed = true | ||
31 | @line_notes = project.commit_line_notes(@commit) | 32 | @line_notes = project.commit_line_notes(@commit) |
32 | 33 | ||
33 | respond_to do |format| | 34 | respond_to do |format| |
app/views/commits/_text_file.html.haml
@@ -8,12 +8,14 @@ | @@ -8,12 +8,14 @@ | ||
8 | - else | 8 | - else |
9 | %td.old_line | 9 | %td.old_line |
10 | = link_to raw(type == "new" ? " " : line_old), "##{line_code}", :id => line_code | 10 | = link_to raw(type == "new" ? " " : line_old), "##{line_code}", :id => line_code |
11 | - = link_to "", "#", :class => "line_note_link", "line_code" => line_code, :title => "Add note for this line" | 11 | + - if @comments_allowed |
12 | + = link_to "", "#", :class => "line_note_link", "line_code" => line_code, :title => "Add note for this line" | ||
12 | %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", :id => line_code | 13 | %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", :id => line_code |
13 | %td.line_content{:class => "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " | 14 | %td.line_content{:class => "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " |
14 | - | ||
15 | - - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse | ||
16 | - - unless comments.empty? | ||
17 | - - comments.each do |note| | ||
18 | - = render "notes/per_line_show", :note => note | ||
19 | - - @line_notes.reject!{ |n| n == note } | 15 | + |
16 | + - if @comments_allowed | ||
17 | + - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse | ||
18 | + - unless comments.empty? | ||
19 | + - comments.each do |note| | ||
20 | + = render "notes/per_line_show", :note => note | ||
21 | + - @line_notes.reject!{ |n| n == note } |
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +- url = content.url(@ref) | ||
2 | +- name = content.basename | ||
3 | +- return unless url | ||
4 | +%tr{ :class => "tree-item", :url => url } | ||
5 | + %td.tree-item-file-name | ||
6 | + = image_tag "submodule.png" | ||
7 | + %strong= truncate(name, :length => 40) | ||
8 | + %td | ||
9 | + %code= content.id[0..10] | ||
10 | + %td | ||
11 | + = link_to truncate(url, :length => 40), url | ||
12 | + | ||
13 | + |
app/views/refs/_tree.html.haml
@@ -39,6 +39,8 @@ | @@ -39,6 +39,8 @@ | ||
39 | = render :partial => "refs/tree_item", :locals => { :content => content } | 39 | = render :partial => "refs/tree_item", :locals => { :content => content } |
40 | - contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content| | 40 | - contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content| |
41 | = render :partial => "refs/tree_item", :locals => { :content => content } | 41 | = render :partial => "refs/tree_item", :locals => { :content => content } |
42 | + - contents.select{ |i| i.is_a?(Grit::Submodule)}.each do |content| | ||
43 | + = render :partial => "refs/submodule_item", :locals => { :content => content } | ||
42 | 44 | ||
43 | - if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first | 45 | - if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first |
44 | #tree-readme-holder | 46 | #tree-readme-holder |
app/views/refs/_tree_item.html.haml
@@ -15,4 +15,4 @@ | @@ -15,4 +15,4 @@ | ||
15 | - tm = @project.team_member_by_name_or_email(content_commit.author_email, content_commit.author_name) | 15 | - tm = @project.team_member_by_name_or_email(content_commit.author_email, content_commit.author_name) |
16 | - if tm | 16 | - if tm |
17 | = link_to "[#{tm.user_name}]", project_team_member_path(@project, tm) | 17 | = link_to "[#{tm.user_name}]", project_team_member_path(@project, tm) |
18 | - = link_to truncate(content_commit.safe_message, :length => tm ? 20 : 40), project_commit_path(@project, content_commit.id), :class => "tree-commit-link" | 18 | + = link_to truncate(content_commit.safe_message, :length => tm ? 30 : 50), project_commit_path(@project, content_commit.id), :class => "tree-commit-link" |