Link project version to changelog if there is one.

This commit is contained in:
Douwe Maan 2015-03-17 10:29:17 +01:00
parent 31e484085a
commit 6581aea3bf
2 changed files with 10 additions and 2 deletions

View File

@ -122,7 +122,7 @@ class Repository
def expire_cache
%i(size branch_names tag_names commit_count graph_log
readme version contribution_guide).each do |key|
readme version contribution_guide changelog).each do |key|
cache.expire(key)
end
end
@ -203,6 +203,13 @@ class Repository
end
end
end
def changelog
cache.fetch(:changelog) do
tree(:head).blobs.find do |file|
file.name =~ /^(changelog|history)/i
end
end
end
def head_commit

View File

@ -52,7 +52,8 @@
- if @repository.version
- version = @repository.version
= link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, version.name)), class: 'btn btn-block' do
- detail_file = @repository.changelog.try(:name) || version.name
= link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, detail_file)), class: 'btn btn-block' do
Version:
%span.count
= @repository.blob_by_oid(version.id).data