tree.readme method added
This commit is contained in:
parent
453b2ae68b
commit
76e1ca6430
|
@ -28,4 +28,8 @@ class TreeDecorator < ApplicationDecorator
|
||||||
file = File.join(path, "..")
|
file = File.join(path, "..")
|
||||||
h.project_tree_path(project, h.tree_join(ref, file))
|
h.project_tree_path(project, h.tree_join(ref, file))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def readme
|
||||||
|
@readme ||= contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
|
|
||||||
= render_tree(tree.contents)
|
= render_tree(tree.contents)
|
||||||
|
|
||||||
- if readme = tree.contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i }
|
- if tree.readme
|
||||||
= render "tree/readme", readme: readme
|
= render "tree/readme", readme: tree.readme
|
||||||
|
|
||||||
- unless tree.is_blob?
|
- unless tree.is_blob?
|
||||||
:javascript
|
:javascript
|
||||||
|
|
Loading…
Reference in a new issue