diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-29 13:10:52 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-29 13:10:52 +0000 |
commit | 8a650f5d4aada203465f8b343b5fef9789425cbd (patch) | |
tree | e95ed88a3bee999580e5c82aa997be300b6db72a | |
parent | 071de30f80ea471c48f52ff1f5d728089b75a8c0 (diff) | |
parent | 81fe86b4279775b3cbed2d64529d671d6fbe49d2 (diff) | |
download | gitlab-ce-8a650f5d4aada203465f8b343b5fef9789425cbd.tar.gz |
Merge branch 'feature/readme_link' of /home/git/repositories/gitlab/gitlabhq
-rw-r--r-- | app/models/repository.rb | 7 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 58130700571..1255b814533 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -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 diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 41035d91756..bfcd917d7f4 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -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 |