Commit 56d15660b8e89ae0bc37953b4fe24739323e5921

Authored by Dmitriy Zaporozhets
1 parent 083d6656

gitlab_git to 1.0.6, return submodule rendering in tree

CHANGELOG
... ... @@ -8,6 +8,7 @@ v 5.2.0
8 8 - Move Gitlab::Git code to gitlab_git gem
9 9 - Move update docs in repo
10 10 - requires gitlab-shell v1.4.0
  11 + - fixed submodules listing under file tab
11 12  
12 13 v 5.1.0
13 14 - You can login with email or username now
... ...
Gemfile
... ... @@ -24,7 +24,7 @@ gem 'omniauth-github'
24 24 # Extracting information from a git repository
25 25 # We cannot use original git since some bugs
26 26 gem "grit", '~> 2.5.0', git: 'https://github.com/gitlabhq/grit.git', ref: '42297cdcee16284d2e4eff23d41377f52fc28b9d'
27   -gem 'gitlab_git', '~> 1.0.5'
  27 +gem 'gitlab_git', '~> 1.0.6'
28 28  
29 29 # Ruby/Rack Git Smart-HTTP Server Handler
30 30 gem 'gitlab-grack', '~> 1.0.0', require: 'grack'
... ...
Gemfile.lock
... ... @@ -165,7 +165,7 @@ GEM
165 165 gitlab-pygments.rb (0.3.2)
166 166 posix-spawn (~> 0.3.6)
167 167 yajl-ruby (~> 1.1.0)
168   - gitlab_git (1.0.5)
  168 + gitlab_git (1.0.6)
169 169 activesupport (~> 3.2.13)
170 170 github-linguist (~> 2.3.4)
171 171 grit (~> 2.5.0)
... ... @@ -518,7 +518,7 @@ DEPENDENCIES
518 518 github-markup (~> 0.7.4)
519 519 gitlab-grack (~> 1.0.0)
520 520 gitlab-pygments.rb (~> 0.3.2)
521   - gitlab_git (~> 1.0.5)
  521 + gitlab_git (~> 1.0.6)
522 522 gitlab_meta (= 5.0)
523 523 gitlab_omniauth-ldap (= 1.0.2)
524 524 gollum-lib (~> 1.0.0)
... ...
app/helpers/tree_helper.rb
... ... @@ -5,24 +5,18 @@ module TreeHelper
5 5 # contents - A Grit::Tree object for the current tree
6 6 def render_tree(tree)
7 7 # Render Folders before Files/Submodules
8   - folders, files = tree.trees, tree.blobs
  8 + folders, files, submodules = tree.trees, tree.blobs, tree.submodules
9 9  
10 10 tree = ""
11 11  
12 12 # Render folders if we have any
13 13 tree += render partial: 'tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present?
14 14  
15   - files.each do |f|
16   - html = if f.respond_to?(:url)
17   - # Object is a Submodule
18   - render partial: 'tree/submodule_item', object: f
19   - else
20   - # Object is a Blob
21   - render partial: 'tree/blob_item', object: f, locals: {type: 'file'}
22   - end
  15 + # Render files if we have any
  16 + tree += render partial: 'tree/blob_item', collection: files, locals: {type: 'file'} if files.present?
23 17  
24   - tree += html if html.present?
25   - end
  18 + # Render submodules if we have any
  19 + tree += render partial: 'tree/submodule_item', collection: submodules if submodules.present?
26 20  
27 21 tree.html_safe
28 22 end
... ...