From a7bcc2eb5ce47a691e2afa3d5e597eb1710600ca Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 14 Feb 2012 23:48:42 +0200 Subject: [PATCH] submodules displayed for tree view --- app/assets/images/submodule.png | Bin 0 -> 641 bytes app/assets/stylesheets/common.scss | 9 ++++++++- app/assets/stylesheets/tree.scss | 4 ++++ app/controllers/commits_controller.rb | 1 + app/views/commits/_text_file.html.haml | 16 +++++++++------- app/views/refs/_submodule_item.html.haml | 13 +++++++++++++ app/views/refs/_tree.html.haml | 2 ++ app/views/refs/_tree_item.html.haml | 2 +- 8 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 app/assets/images/submodule.png create mode 100644 app/views/refs/_submodule_item.html.haml diff --git a/app/assets/images/submodule.png b/app/assets/images/submodule.png new file mode 100644 index 0000000000000000000000000000000000000000..62a88cc619b1b7c21aeae765c5ac5b94cf3bff57 GIT binary patch literal 641 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s77>k44ofy`glX=O&z`&N| z?e4IEu9GFHU==cY2dYLvNITu=RZhVdo^@#5W&w*Yvtob4yE0pDsNt zyn<7tOzqnYf#gMk2D>*1m8I_eeom&F`!rK4>++c=Pd>4}|8sJq_p~|rHI-Yd%6Dvz zz82k`F2Abi%H744TfdgBzyJPT-LHR236DR1ik>dMI)$4dFV`y{Z z|Gx)cpJ^uiJ-OGt_t}@ziSH+@F>GF;6c?!8p%pN9adWM(Xk^_!J%)cQ2Ad21o~l{v zzSDMzp5Vu>)vR;Qf7sfPCRb=s!t437K;95I5o0*f3mycJDm(Rr@^v7jp z?=8FLzY}r&cy9TWK9?u$$7-gW)e|}`_;o^~)+#=6rghH>w>DJyUzAt)sxBT<{`8&34JGS(-yyMOHLids;3o$S-FnGH9xvX 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" ? " " : line_new) , "##{line_code}", :id => line_code %td.line_content{:class => "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line}  " - - - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse - - unless comments.empty? - - comments.each do |note| - = render "notes/per_line_show", :note => note - - @line_notes.reject!{ |n| n == note } + + - if @comments_allowed + - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse + - unless comments.empty? + - comments.each do |note| + = render "notes/per_line_show", :note => note + - @line_notes.reject!{ |n| n == note } diff --git a/app/views/refs/_submodule_item.html.haml b/app/views/refs/_submodule_item.html.haml new file mode 100644 index 00000000000..fc32c37b9a4 --- /dev/null +++ b/app/views/refs/_submodule_item.html.haml @@ -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 + + diff --git a/app/views/refs/_tree.html.haml b/app/views/refs/_tree.html.haml index d1fcc2958bf..e2360360ad8 100644 --- a/app/views/refs/_tree.html.haml +++ b/app/views/refs/_tree.html.haml @@ -39,6 +39,8 @@ = render :partial => "refs/tree_item", :locals => { :content => content } - contents.select{ |i| i.is_a?(Grit::Blob)}.each do |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 #tree-readme-holder diff --git a/app/views/refs/_tree_item.html.haml b/app/views/refs/_tree_item.html.haml index 73385514cd0..b5c29220da7 100644 --- a/app/views/refs/_tree_item.html.haml +++ b/app/views/refs/_tree_item.html.haml @@ -15,4 +15,4 @@ - tm = @project.team_member_by_name_or_email(content_commit.author_email, content_commit.author_name) - if 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" -- GitLab