README link from project home page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
071de30f80
commit
81fe86b427
2 changed files with 13 additions and 0 deletions
|
@ -133,6 +133,7 @@ class Repository
|
|||
Rails.cache.delete(cache_key(:tag_names))
|
||||
Rails.cache.delete(cache_key(:commit_count))
|
||||
Rails.cache.delete(cache_key(:graph_log))
|
||||
Rails.cache.delete(cache_key(:readme))
|
||||
end
|
||||
|
||||
def graph_log
|
||||
|
@ -159,4 +160,10 @@ class Repository
|
|||
def blob_at(sha, path)
|
||||
Gitlab::Git::Blob.find(self, sha, path)
|
||||
end
|
||||
|
||||
def readme
|
||||
Rails.cache.fetch(cache_key(:readme)) do
|
||||
Tree.new(self, self.root_ref).readme
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,6 +31,12 @@
|
|||
%span Download
|
||||
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do
|
||||
Compare code
|
||||
|
||||
- if @repository.readme
|
||||
- readme = @repository.readme
|
||||
= link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)), class: 'btn btn-block' do
|
||||
= readme.name
|
||||
|
||||
.prepend-top-10
|
||||
%p
|
||||
%span.light Created on
|
||||
|
|
Loading…
Reference in a new issue