Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
a99ad3d3
Commit
a99ad3d3
authored
Mar 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tree_heleper: concat html only if present. Avoid nil exception
parent
9ba21dd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+9
-7
No files found.
app/helpers/tree_helper.rb
View file @
a99ad3d3
...
@@ -13,13 +13,15 @@ module TreeHelper
...
@@ -13,13 +13,15 @@ module TreeHelper
tree
+=
render
partial:
'tree/tree_item'
,
collection:
folders
,
locals:
{
type:
'folder'
}
if
folders
.
present?
tree
+=
render
partial:
'tree/tree_item'
,
collection:
folders
,
locals:
{
type:
'folder'
}
if
folders
.
present?
files
.
each
do
|
f
|
files
.
each
do
|
f
|
if
f
.
respond_to?
(
:url
)
html
=
if
f
.
respond_to?
(
:url
)
# Object is a Submodule
# Object is a Submodule
tree
+=
render
partial:
'tree/submodule_item'
,
object:
f
render
partial:
'tree/submodule_item'
,
object:
f
else
else
# Object is a Blob
# Object is a Blob
tree
+=
render
partial:
'tree/tree_item'
,
object:
f
,
locals:
{
type:
'file'
}
render
partial:
'tree/tree_item'
,
object:
f
,
locals:
{
type:
'file'
}
end
end
tree
+=
html
if
html
.
present?
end
end
tree
.
html_safe
tree
.
html_safe
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment