Commit a7bcc2eb5ce47a691e2afa3d5e597eb1710600ca

Authored by Dmitriy Zaporozhets
1 parent c062e56b

submodules displayed for tree view

app/assets/images/submodule.png 0 → 100644

641 Bytes

app/assets/stylesheets/common.scss
... ... @@ -234,12 +234,19 @@ img.lil_av {
234 234 border-color:#ddd;
235 235  
236 236 h5 {
237   - padding: 5px 10px;
  237 + padding: 0 10px;
238 238 background:#f5f5f5;
239 239 border-bottom: 1px solid #ccc;
  240 + @include round-borders-top(4px);
  241 + border-top:none;
240 242 }
241 243  
242 244 li {
243 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
... ... @@ -144,3 +144,7 @@ table.highlighttable .linenodiv pre {
144 144 background:#f5f5f5;
145 145 }
146 146 }
  147 +
  148 +.tree-commit-link {
  149 + color:#333;
  150 +}
... ...
app/controllers/commits_controller.rb
... ... @@ -28,6 +28,7 @@ class CommitsController < ApplicationController
28 28 @notes = project.commit_notes(@commit).fresh.limit(20)
29 29 @note = @project.build_commit_note(@commit)
30 30  
  31 + @comments_allowed = true
31 32 @line_notes = project.commit_line_notes(@commit)
32 33  
33 34 respond_to do |format|
... ...
app/views/commits/_text_file.html.haml
... ... @@ -8,12 +8,14 @@
8 8 - else
9 9 %td.old_line
10 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 13 %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", :id => line_code
13 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 }
... ...
app/views/refs/_submodule_item.html.haml 0 → 100644
... ... @@ -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 39 = render :partial => "refs/tree_item", :locals => { :content => content }
40 40 - contents.select{ |i| i.is_a?(Grit::Blob)}.each do |content|
41 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 45 - if content = contents.select{ |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }.first
44 46 #tree-readme-holder
... ...
app/views/refs/_tree_item.html.haml
... ... @@ -15,4 +15,4 @@
15 15 - tm = @project.team_member_by_name_or_email(content_commit.author_email, content_commit.author_name)
16 16 - if tm
17 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"
... ...