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
Léo-Paul Géneau
gitlab-ce
Commits
7a167cf1
Commit
7a167cf1
authored
Jul 16, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move branches list to own controller with pagination. Ability to remove branches from UI
parent
a466b217
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
75 additions
and
28 deletions
+75
-28
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+3
-0
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+24
-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/_branch.html.haml
app/views/projects/branches/_branch.html.haml
+27
-0
app/views/projects/branches/index.html.haml
app/views/projects/branches/index.html.haml
+10
-0
app/views/projects/repositories/_filter.html.haml
app/views/projects/repositories/_filter.html.haml
+2
-2
app/views/projects/repositories/branches.html.haml
app/views/projects/repositories/branches.html.haml
+0
-15
app/views/projects/repositories/show.html.haml
app/views/projects/repositories/show.html.haml
+2
-7
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/assets/javascripts/main.js.coffee
View file @
7a167cf1
...
@@ -62,6 +62,9 @@ $ ->
...
@@ -62,6 +62,9 @@ $ ->
# Click a .one_click_select field, select the contents
# Click a .one_click_select field, select the contents
$
(
".one_click_select"
).
on
'click'
,
->
$
(
@
).
select
()
$
(
".one_click_select"
).
on
'click'
,
->
$
(
@
).
select
()
$
(
'.remove-row'
).
bind
'ajax:success'
,
->
$
(
this
).
closest
(
'li'
).
fadeOut
()
# Click a .appear-link, appear-data fadeout
# Click a .appear-link, appear-data fadeout
$
(
".appear-link"
).
on
'click'
,
(
e
)
->
$
(
".appear-link"
).
on
'click'
,
(
e
)
->
$
(
'.appear-data'
).
fadeIn
()
$
(
'.appear-data'
).
fadeIn
()
...
...
app/controllers/projects/branches_controller.rb
0 → 100644
View file @
7a167cf1
class
Projects::BranchesController
<
Projects
::
ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:require_non_empty_project
before_filter
:authorize_admin_project!
,
only:
[
:destroy
,
:create
]
def
index
@branches
=
Kaminari
.
paginate_array
(
@repository
.
branches
).
page
(
params
[
:page
]).
per
(
30
)
end
def
create
# TODO: implement
end
def
destroy
@project
.
repository
.
rm_branch
(
params
[
:id
])
respond_to
do
|
format
|
format
.
html
{
redirect_to
project_branches_path
}
format
.
js
{
render
nothing:
true
}
end
end
end
app/controllers/projects/repositories_controller.rb
View file @
7a167cf1
...
@@ -8,10 +8,6 @@ class Projects::RepositoriesController < Projects::ApplicationController
...
@@ -8,10 +8,6 @@ class Projects::RepositoriesController < Projects::ApplicationController
@activities
=
@repository
.
commits_with_refs
(
20
)
@activities
=
@repository
.
commits_with_refs
(
20
)
end
end
def
branches
@branches
=
@repository
.
branches
end
def
tags
def
tags
@tags
=
@repository
.
tags
@tags
=
@repository
.
tags
end
end
...
...
app/models/repository.rb
View file @
7a167cf1
class
Repository
class
Repository
include
Gitlab
::
ShellAdapter
attr_accessor
:raw_repository
attr_accessor
:raw_repository
def
initialize
(
path_with_namespace
,
default_branch
)
def
initialize
(
path_with_namespace
,
default_branch
)
...
@@ -33,6 +35,10 @@ class Repository
...
@@ -33,6 +35,10 @@ class Repository
commits
commits
end
end
def
rm_branch
(
branch_name
)
gitlab_shell
.
rm_branch
(
path_with_namespace
,
branch_name
)
end
def
round_commit_count
def
round_commit_count
if
commit_count
>
10000
if
commit_count
>
10000
'10000+'
'10000+'
...
...
app/views/projects/
repositori
es/_branch.html.haml
→
app/views/projects/
branch
es/_branch.html.haml
View file @
7a167cf1
-
commit
=
Commit
.
new
(
Gitlab
::
Git
::
Commit
.
new
(
branch
.
commit
))
-
commit
=
Commit
.
new
(
Gitlab
::
Git
::
Commit
.
new
(
branch
.
commit
))
%
tr
%
li
%
td
%
h4
=
link_to
project_commits_path
(
@project
,
branch
.
name
)
do
=
link_to
project_commits_path
(
@project
,
branch
.
name
)
do
-
if
@project
.
protected_branch?
branch
.
name
%i
.icon-lock
-
else
%i
.icon-unlock
%strong
=
truncate
(
branch
.
name
,
length:
60
)
%strong
=
truncate
(
branch
.
name
,
length:
60
)
-
if
branch
.
name
==
@repository
.
root_ref
-
if
branch
.
name
==
@repository
.
root_ref
%span
.label
default
%span
.label.label-info
default
%td
-
if
@project
.
protected_branch?
branch
.
name
%span
.label.label-success
%i
.icon-lock
.pull-right
-
if
can?
(
current_user
,
:download_code
,
@project
)
=
link_to
archive_project_repository_path
(
@project
,
ref:
branch
.
name
),
class:
'btn grouped btn-small'
do
%i
.icon-download-alt
-
if
can?
(
current_user
,
:admin_project
,
@project
)
&&
branch
.
name
!=
@repository
.
root_ref
=
link_to
project_branch_path
(
@project
,
branch
.
name
),
class:
'btn grouped btn-small remove-row'
,
method: :delete
,
confirm:
'Removed branch cannot be restored. Are you sure?'
,
remote:
true
do
%i
.icon-trash
%p
=
link_to
project_commit_path
(
@project
,
commit
.
id
),
class:
'commit_short_id'
do
=
link_to
project_commit_path
(
@project
,
commit
.
id
),
class:
'commit_short_id'
do
=
commit
.
short_id
=
commit
.
short_id
=
image_tag
gravatar_icon
(
commit
.
author_email
),
class:
"avatar s16"
,
alt:
''
=
image_tag
gravatar_icon
(
commit
.
author_email
),
class:
"avatar s16"
,
alt:
''
...
@@ -18,9 +25,3 @@
...
@@ -18,9 +25,3 @@
%span
%span
=
time_ago_in_words
(
commit
.
committed_date
)
=
time_ago_in_words
(
commit
.
committed_date
)
ago
ago
%td
-
if
can?
current_user
,
:download_code
,
@project
=
link_to
archive_project_repository_path
(
@project
,
ref:
branch
.
name
)
do
%i
.icon-download-alt
Download
app/views/projects/branches/index.html.haml
0 → 100644
View file @
7a167cf1
=
render
"projects/commits/head"
.row
.span3
=
render
"projects/repositories/filter"
.span9
-
unless
@branches
.
empty?
%ul
.bordered-list
-
@branches
.
each
do
|
branch
|
=
render
"projects/branches/branch"
,
branch:
branch
=
paginate
@branches
,
theme:
'gitlab'
app/views/projects/repositories/_filter.html.haml
View file @
7a167cf1
...
@@ -5,5 +5,5 @@
...
@@ -5,5 +5,5 @@
=
link_to
project_protected_branches_path
(
@project
)
do
=
link_to
project_protected_branches_path
(
@project
)
do
Protected
Protected
%i
.icon-lock
%i
.icon-lock
=
nav_link
(
path:
'
repositories#branches
'
)
do
=
nav_link
(
path:
'
branches#index
'
)
do
=
link_to
'All branches'
,
branches_project_repository
_path
(
@project
)
=
link_to
'All branches'
,
project_branches
_path
(
@project
)
app/views/projects/repositories/branches.html.haml
deleted
100644 → 0
View file @
a466b217
=
render
"projects/commits/head"
.row
.span3
=
render
"filter"
.span9
-
unless
@branches
.
empty?
%table
%thead
%tr
%th
Name
%th
Last commit
%th
%tbody
-
@branches
.
each
do
|
branch
|
=
render
"projects/repositories/branch"
,
branch:
branch
app/views/projects/repositories/show.html.haml
View file @
7a167cf1
...
@@ -3,12 +3,7 @@
...
@@ -3,12 +3,7 @@
.span3
.span3
=
render
"filter"
=
render
"filter"
.span9
.span9
%table
%ul
.bordered-list
%thead
%tr
%th
Name
%th
Last commit
%th
-
@activities
.
each
do
|
update
|
-
@activities
.
each
do
|
update
|
=
render
"branch"
,
branch:
update
.
head
=
render
"
projects/branches/
branch"
,
branch:
update
.
head
config/routes.rb
View file @
7a167cf1
...
@@ -225,6 +225,7 @@ Gitlab::Application.routes.draw do
...
@@ -225,6 +225,7 @@ Gitlab::Application.routes.draw do
end
end
end
end
resources
:branches
,
only:
[
:index
,
: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