Commit 5baac669 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

More info (like 10 branches, 5 tags) at project show page

parent 63e532ef
......@@ -33,6 +33,18 @@ class Repository
commits
end
def round_commit_count
if commit_count > 10000
'10000+'
elsif commit_count > 5000
'5000+'
elsif commit_count > 1000
'1000+'
else
commit_count
end
end
def branch_names
Rails.cache.fetch(cache_key(:branch_names)) do
raw_repository.branch_names
......@@ -45,8 +57,10 @@ class Repository
end
end
def method_missing(m, *args, &block)
raw_repository.send(m, *args, &block)
def commit_count
Rails.cache.fetch(cache_key(:commit_count)) do
raw_repository.raw.commit_count
end
end
# Return repo size in megabytes
......@@ -61,6 +75,7 @@ class Repository
Rails.cache.delete(cache_key(:size))
Rails.cache.delete(cache_key(:branch_names))
Rails.cache.delete(cache_key(:tag_names))
Rails.cache.delete(cache_key(:commit_count))
Rails.cache.delete(cache_key(:graph_log))
end
......@@ -75,6 +90,10 @@ class Repository
"#{type}:#{path_with_namespace}"
end
def method_missing(m, *args, &block)
raw_repository.send(m, *args, &block)
end
def respond_to?(method)
return true if raw_repository.respond_to?(method)
......
......@@ -37,9 +37,18 @@
%hr
%p
%p Repo Size: #{@project.repository.size} MB
%p Created on: #{@project.created_at.stamp('Aug 22, 2013')}
%p Owner: #{link_to @project.owner_name, @project.owner}
%p
%span.light Repo size is
#{@project.repository.size} MB
%p
%span.light Created at
#{@project.created_at.stamp('Aug 22, 2013')}
%p
%span.light Owned by
- if @project.group
#{link_to @project.group.name, @project.group} Group
- else
#{link_to @project.owner_name, @project.owner}
- if @project.forked_from_project
%p
%i.icon-code-fork
......@@ -50,3 +59,11 @@
%hr
= link_to @project.gitlab_ci_service.builds_path do
= image_tag @project.gitlab_ci_service.status_img_path, alt: "build status"
%hr
%p
= link_to pluralize(@repository.round_commit_count, 'commit'), project_commits_path(@project)
%p
= link_to pluralize(@repository.branch_names.count, 'branch'), project_repository_path(@project)
%p
= link_to pluralize(@repository.tag_names.count, 'tag'), tags_project_repository_path(@project)
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