Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
5baac669
Commit
5baac669
authored
Jul 09, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More info (like 10 branches, 5 tags) at project show page
parent
63e532ef
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
5 deletions
+41
-5
app/models/repository.rb
app/models/repository.rb
+21
-2
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+20
-3
No files found.
app/models/repository.rb
View file @
5baac669
...
@@ -33,6 +33,18 @@ class Repository
...
@@ -33,6 +33,18 @@ class Repository
commits
commits
end
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
def
branch_names
Rails
.
cache
.
fetch
(
cache_key
(
:branch_names
))
do
Rails
.
cache
.
fetch
(
cache_key
(
:branch_names
))
do
raw_repository
.
branch_names
raw_repository
.
branch_names
...
@@ -45,8 +57,10 @@ class Repository
...
@@ -45,8 +57,10 @@ class Repository
end
end
end
end
def
method_missing
(
m
,
*
args
,
&
block
)
def
commit_count
raw_repository
.
send
(
m
,
*
args
,
&
block
)
Rails
.
cache
.
fetch
(
cache_key
(
:commit_count
))
do
raw_repository
.
raw
.
commit_count
end
end
end
# Return repo size in megabytes
# Return repo size in megabytes
...
@@ -61,6 +75,7 @@ class Repository
...
@@ -61,6 +75,7 @@ class Repository
Rails
.
cache
.
delete
(
cache_key
(
:size
))
Rails
.
cache
.
delete
(
cache_key
(
:size
))
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
Rails
.
cache
.
delete
(
cache_key
(
:tag_names
))
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
(
:graph_log
))
end
end
...
@@ -75,6 +90,10 @@ class Repository
...
@@ -75,6 +90,10 @@ class Repository
"
#{
type
}
:
#{
path_with_namespace
}
"
"
#{
type
}
:
#{
path_with_namespace
}
"
end
end
def
method_missing
(
m
,
*
args
,
&
block
)
raw_repository
.
send
(
m
,
*
args
,
&
block
)
end
def
respond_to?
(
method
)
def
respond_to?
(
method
)
return
true
if
raw_repository
.
respond_to?
(
method
)
return
true
if
raw_repository
.
respond_to?
(
method
)
...
...
app/views/projects/show.html.haml
View file @
5baac669
...
@@ -37,9 +37,18 @@
...
@@ -37,9 +37,18 @@
%hr
%hr
%p
%p
%p
Repo Size:
#{
@project
.
repository
.
size
}
MB
%p
%p
Created on:
#{
@project
.
created_at
.
stamp
(
'Aug 22, 2013'
)
}
%span
.light
Repo size is
%p
Owner:
#{
link_to
@project
.
owner_name
,
@project
.
owner
}
#{
@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
-
if
@project
.
forked_from_project
%p
%p
%i
.icon-code-fork
%i
.icon-code-fork
...
@@ -50,3 +59,11 @@
...
@@ -50,3 +59,11 @@
%hr
%hr
=
link_to
@project
.
gitlab_ci_service
.
builds_path
do
=
link_to
@project
.
gitlab_ci_service
.
builds_path
do
=
image_tag
@project
.
gitlab_ci_service
.
status_img_path
,
alt:
"build status"
=
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment