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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
88c741dd
Commit
88c741dd
authored
Aug 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor recent branches page
parent
bb5e50e0
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
10 deletions
+29
-10
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+4
-0
app/controllers/projects/repositories_controller.rb
app/controllers/projects/repositories_controller.rb
+0
-4
app/models/repository.rb
app/models/repository.rb
+6
-0
app/views/projects/branches/_filter.html.haml
app/views/projects/branches/_filter.html.haml
+2
-2
app/views/projects/branches/index.html.haml
app/views/projects/branches/index.html.haml
+1
-1
app/views/projects/branches/recent.html.haml
app/views/projects/branches/recent.html.haml
+8
-0
app/views/projects/commits/_head.html.haml
app/views/projects/commits/_head.html.haml
+1
-1
app/views/projects/protected_branches/index.html.haml
app/views/projects/protected_branches/index.html.haml
+1
-1
config/routes.rb
config/routes.rb
+6
-1
No files found.
app/controllers/projects/branches_controller.rb
View file @
88c741dd
...
@@ -11,6 +11,10 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -11,6 +11,10 @@ class Projects::BranchesController < Projects::ApplicationController
@branches
=
Kaminari
.
paginate_array
(
@repository
.
branches
).
page
(
params
[
:page
]).
per
(
30
)
@branches
=
Kaminari
.
paginate_array
(
@repository
.
branches
).
page
(
params
[
:page
]).
per
(
30
)
end
end
def
recent
@branches
=
@repository
.
recent_branches
end
def
create
def
create
@repository
.
add_branch
(
params
[
:branch_name
],
params
[
:ref
])
@repository
.
add_branch
(
params
[
:branch_name
],
params
[
:ref
])
...
...
app/controllers/projects/repositories_controller.rb
View file @
88c741dd
...
@@ -4,10 +4,6 @@ class Projects::RepositoriesController < Projects::ApplicationController
...
@@ -4,10 +4,6 @@ class Projects::RepositoriesController < Projects::ApplicationController
before_filter
:authorize_code_access!
before_filter
:authorize_code_access!
before_filter
:require_non_empty_project
before_filter
:require_non_empty_project
def
show
@activities
=
@repository
.
commits_with_refs
(
20
)
end
def
stats
def
stats
@stats
=
Gitlab
::
Git
::
Stats
.
new
(
@repository
.
raw
,
@repository
.
root_ref
)
@stats
=
Gitlab
::
Git
::
Stats
.
new
(
@repository
.
raw
,
@repository
.
root_ref
)
@graph
=
@stats
.
graph
@graph
=
@stats
.
graph
...
...
app/models/repository.rb
View file @
88c741dd
...
@@ -49,6 +49,12 @@ class Repository
...
@@ -49,6 +49,12 @@ class Repository
tags
.
find
{
|
tag
|
tag
.
name
==
name
}
tags
.
find
{
|
tag
|
tag
.
name
==
name
}
end
end
def
recent_branches
(
limit
=
20
)
branches
.
sort
do
|
a
,
b
|
a
.
commit
.
committed_date
<=>
b
.
commit
.
committed_date
end
[
0
..
limit
]
end
def
add_branch
(
branch_name
,
ref
)
def
add_branch
(
branch_name
,
ref
)
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
...
...
app/views/projects/
repositori
es/_filter.html.haml
→
app/views/projects/
branch
es/_filter.html.haml
View file @
88c741dd
%ul
.nav.nav-pills.nav-stacked
%ul
.nav.nav-pills.nav-stacked
=
nav_link
(
path:
'
repositories#show
'
)
do
=
nav_link
(
path:
'
branches#recent
'
)
do
=
link_to
'Recent'
,
project_repository
_path
(
@project
)
=
link_to
'Recent'
,
recent_project_branches
_path
(
@project
)
=
nav_link
(
path:
'protected_branches#index'
)
do
=
nav_link
(
path:
'protected_branches#index'
)
do
=
link_to
project_protected_branches_path
(
@project
)
do
=
link_to
project_protected_branches_path
(
@project
)
do
Protected
Protected
...
...
app/views/projects/branches/index.html.haml
View file @
88c741dd
=
render
"projects/commits/head"
=
render
"projects/commits/head"
.row
.row
.span3
.span3
=
render
"
projects/repositories/
filter"
=
render
"filter"
.span9
.span9
-
unless
@branches
.
empty?
-
unless
@branches
.
empty?
%ul
.bordered-list
%ul
.bordered-list
...
...
app/views/projects/
repositories/show
.html.haml
→
app/views/projects/
branches/recent
.html.haml
View file @
88c741dd
...
@@ -4,6 +4,5 @@
...
@@ -4,6 +4,5 @@
=
render
"filter"
=
render
"filter"
.span9
.span9
%ul
.bordered-list
%ul
.bordered-list
-
@activities
.
each
do
|
update
|
-
@branches
.
each
do
|
branch
|
=
render
"projects/branches/branch"
,
branch:
update
.
head
=
render
"projects/branches/branch"
,
branch:
branch
app/views/projects/commits/_head.html.haml
View file @
88c741dd
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
=
link_to
'Compare'
,
project_compare_index_path
(
@project
)
=
link_to
'Compare'
,
project_compare_index_path
(
@project
)
=
nav_link
(
html_options:
{
class:
branches_tab_class
})
do
=
nav_link
(
html_options:
{
class:
branches_tab_class
})
do
=
link_to
project_repository
_path
(
@project
)
do
=
link_to
recent_project_branches
_path
(
@project
)
do
Branches
Branches
%span
.badge
=
@repository
.
branches
.
length
%span
.badge
=
@repository
.
branches
.
length
...
...
app/views/projects/protected_branches/index.html.haml
View file @
88c741dd
=
render
"projects/commits/head"
=
render
"projects/commits/head"
.row
.row
.span3
.span3
=
render
"projects/
repositori
es/filter"
=
render
"projects/
branch
es/filter"
.span9
.span9
.alert.alert-info
.alert.alert-info
%p
Protected branches designed to prevent push for all except
#{
link_to
"masters"
,
help_permissions_path
,
class:
"vlink"
}
.
%p
Protected branches designed to prevent push for all except
#{
link_to
"masters"
,
help_permissions_path
,
class:
"vlink"
}
.
...
...
config/routes.rb
View file @
88c741dd
...
@@ -225,8 +225,13 @@ Gitlab::Application.routes.draw do
...
@@ -225,8 +225,13 @@ Gitlab::Application.routes.draw do
end
end
end
end
resources
:branches
,
only:
[
:index
,
:new
,
:create
,
:destroy
]
do
collection
do
get
:recent
end
end
resources
:tags
,
only:
[
:index
,
:new
,
:create
,
:destroy
]
resources
:tags
,
only:
[
:index
,
:new
,
:create
,
:destroy
]
resources
:branches
,
only:
[
:index
,
:new
,
:create
,
:destroy
]
resources
:protected_branches
,
only:
[
:index
,
:create
,
:destroy
]
resources
:protected_branches
,
only:
[
:index
,
:create
,
:destroy
]
resources
:refs
,
only:
[]
do
resources
:refs
,
only:
[]
do
...
...
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