Commit 6581aea3 authored by Douwe Maan's avatar Douwe Maan

Link project version to changelog if there is one.

parent 31e48408
...@@ -122,7 +122,7 @@ class Repository ...@@ -122,7 +122,7 @@ class Repository
def expire_cache def expire_cache
%i(size branch_names tag_names commit_count graph_log %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) cache.expire(key)
end end
end end
...@@ -203,6 +203,13 @@ class Repository ...@@ -203,6 +203,13 @@ class Repository
end end
end end
end end
def changelog
cache.fetch(:changelog) do
tree(:head).blobs.find do |file|
file.name =~ /^(changelog|history)/i
end
end
end end
def head_commit def head_commit
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
- if @repository.version - if @repository.version
- version = @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: Version:
%span.count %span.count
= @repository.blob_by_oid(version.id).data = @repository.blob_by_oid(version.id).data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment