summaryrefslogtreecommitdiff
path: root/app/models/tree.rb
diff options
context:
space:
mode:
authorJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2014-02-22 16:37:10 +0100
committerJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2014-02-22 16:37:10 +0100
commitbb35c2d36f4f275cda650c1ad47595c287feba10 (patch)
tree2499f330737de0e26ecc5b4a744b7a3a218a173a /app/models/tree.rb
parent4e0a2e3c968cd6be218577b3a615b888822c99cf (diff)
downloadgitlab-ce-bb35c2d36f4f275cda650c1ad47595c287feba10.tar.gz
Added the contribution guide notice
This is shown at the creation of new issues and new merge requests, when the repository has a contribution guide file.
Diffstat (limited to 'app/models/tree.rb')
-rw-r--r--app/models/tree.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/tree.rb b/app/models/tree.rb
index 4f866f1a33d..f1077772ea9 100644
--- a/app/models/tree.rb
+++ b/app/models/tree.rb
@@ -1,5 +1,5 @@
class Tree
- attr_accessor :entries, :readme
+ attr_accessor :entries, :readme, :contribution_guide
def initialize(repository, sha, path = '/')
path = '/' if path.blank?
@@ -10,6 +10,11 @@ class Tree
readme_path = path == '/' ? readme_tree.name : File.join(path, readme_tree.name)
@readme = Gitlab::Git::Blob.find(git_repo, sha, readme_path)
end
+
+ if contribution_tree = @entries.find(&:contribution?)
+ contribution_path = path == '/' ? contribution_tree.name : File.join(path, contribution_tree.name)
+ @contribution_guide = Gitlab::Git::Blob.find(git_repo, sha, contribution_path)
+ end
end
def trees