Link project version to changelog if there is one.
This commit is contained in:
parent
31e484085a
commit
6581aea3bf
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue