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
1dd0feac
Commit
1dd0feac
authored
Jan 21, 2013
by
Andrey Kumanyaev
Committed by
Dmitriy Zaporozhets
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move Team_members controller into project (conflicts with team/members controller)
parent
497f7ab5
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
107 additions
and
37 deletions
+107
-37
app/controllers/admin/projects/application_controller.rb
app/controllers/admin/projects/application_controller.rb
+11
-0
app/controllers/admin/projects/members_controller.rb
app/controllers/admin/projects/members_controller.rb
+32
-0
app/controllers/admin/team_members_controller.rb
app/controllers/admin/team_members_controller.rb
+0
-22
app/models/project.rb
app/models/project.rb
+5
-0
app/views/admin/projects/members/_form.html.haml
app/views/admin/projects/members/_form.html.haml
+16
-0
app/views/admin/projects/members/edit.html.haml
app/views/admin/projects/members/edit.html.haml
+8
-0
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+6
-6
app/views/admin/team_members/edit.html.haml
app/views/admin/team_members/edit.html.haml
+0
-8
config/routes.rb
config/routes.rb
+3
-1
spec/controllers/admin/projects/members_controller_spec.rb
spec/controllers/admin/projects/members_controller_spec.rb
+26
-0
No files found.
app/controllers/admin/projects/application_controller.rb
0 → 100644
View file @
1dd0feac
# Provides a base class for Admin controllers to subclass
#
# Automatically sets the layout and ensures an administrator is logged in
class
Admin::Projects::ApplicationController
<
Admin
::
ApplicationController
protected
def
project
@project
||=
Project
.
find_by_path
(
params
[
:project_id
])
end
end
app/controllers/admin/projects/members_controller.rb
0 → 100644
View file @
1dd0feac
class
Admin::Projects::MembersController
<
Admin
::
Projects
::
ApplicationController
def
edit
@member
=
team_member
@project
=
project
@team_member_relation
=
team_member_relation
end
def
update
if
team_member_relation
.
update_attributes
(
params
[
:team_member
])
redirect_to
[
:admin
,
project
],
notice:
'Project Access was successfully updated.'
else
render
action:
"edit"
end
end
def
destroy
team_member_relation
.
destroy
redirect_to
:back
end
private
def
team_member
@member
||=
project
.
users
.
find
(
params
[
:id
])
end
def
team_member_relation
team_member
.
users_projects
.
find_by_project_id
(
project
)
end
end
app/controllers/admin/team_members_controller.rb
deleted
100644 → 0
View file @
497f7ab5
class
Admin::TeamMembersController
<
Admin
::
ApplicationController
def
edit
@admin_team_member
=
UsersProject
.
find
(
params
[
:id
])
end
def
update
@admin_team_member
=
UsersProject
.
find
(
params
[
:id
])
if
@admin_team_member
.
update_attributes
(
params
[
:team_member
])
redirect_to
[
:admin
,
@admin_team_member
.
project
],
notice:
'Project Access was successfully updated.'
else
render
action:
"edit"
end
end
def
destroy
@admin_team_member
=
UsersProject
.
find
(
params
[
:id
])
@admin_team_member
.
destroy
redirect_to
:back
end
end
app/models/project.rb
View file @
1dd0feac
...
@@ -494,6 +494,11 @@ class Project < ActiveRecord::Base
...
@@ -494,6 +494,11 @@ class Project < ActiveRecord::Base
http_url
=
[
Gitlab
.
config
.
gitlab
.
url
,
"/"
,
path_with_namespace
,
".git"
].
join
(
''
)
http_url
=
[
Gitlab
.
config
.
gitlab
.
url
,
"/"
,
path_with_namespace
,
".git"
].
join
(
''
)
end
end
def
project_access_human
(
member
)
project_user_relation
=
self
.
users_projects
.
find_by_user_id
(
member
.
id
)
self
.
class
.
access_options
.
key
(
project_user_relation
.
project_access
)
end
# Check if current branch name is marked as protected in the system
# Check if current branch name is marked as protected in the system
def
protected_branch?
branch_name
def
protected_branch?
branch_name
protected_branches
.
map
(
&
:name
).
include?
(
branch_name
)
protected_branches
.
map
(
&
:name
).
include?
(
branch_name
)
...
...
app/views/admin/
team_
members/_form.html.haml
→
app/views/admin/
projects/
members/_form.html.haml
View file @
1dd0feac
=
form_for
@
admin_team_member
,
as: :team_member
,
url:
admin_team_member_path
(
@admin_team_
member
)
do
|
f
|
=
form_for
@
team_member_relation
,
as: :team_member
,
url:
admin_project_member_path
(
@project
,
@
member
)
do
|
f
|
-
if
@
admin_team_member
.
errors
.
any?
-
if
@
team_member_relation
.
errors
.
any?
.alert-message.block-message.error
.alert-message.block-message.error
%ul
%ul
-
@
admin_team_member
.
errors
.
full_messages
.
each
do
|
msg
|
-
@
team_member_relation
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
%li
=
msg
.clearfix
.clearfix
%label
Project Access:
%label
Project Access:
.input
.input
=
f
.
select
:project_access
,
options_for_select
(
Project
.
access_options
,
@
admin_team_member
.
project_access
),
{},
class:
"project-access-select chosen span3"
=
f
.
select
:project_access
,
options_for_select
(
Project
.
access_options
,
@
team_member_relation
.
project_access
),
{},
class:
"project-access-select chosen span3"
%br
%br
.actions
.actions
...
...
app/views/admin/projects/members/edit.html.haml
0 → 100644
View file @
1dd0feac
%p
.slead
Edit access for
=
link_to
@member
.
name
,
admin_user_path
(
@member
)
in
=
link_to
@project
.
name_with_namespace
,
admin_project_path
(
@project
)
%hr
=
render
'form'
app/views/admin/projects/show.html.haml
View file @
1dd0feac
...
@@ -114,7 +114,7 @@
...
@@ -114,7 +114,7 @@
%h5
%h5
Team
Team
%small
%small
(
#{
@project
.
users
_projects
.
count
}
)
(
#{
@project
.
users
.
count
}
)
%br
%br
%table
.zebra-striped.team_members
%table
.zebra-striped.team_members
%thead
%thead
...
@@ -124,13 +124,13 @@
...
@@ -124,13 +124,13 @@
%th
Repository Access
%th
Repository Access
%th
%th
-
@project
.
users
_projects
.
each
do
|
tm
|
-
@project
.
users
.
each
do
|
tm
|
%tr
%tr
%td
%td
=
link_to
tm
.
user_name
,
admin_user_path
(
tm
.
user
)
=
link_to
tm
.
name
,
admin_user_path
(
tm
)
%td
=
tm
.
project_access_human
%td
=
@project
.
project_access_human
(
tm
)
%td
=
link_to
'Edit Access'
,
edit_admin_
team_member_path
(
tm
),
class:
"btn small"
%td
=
link_to
'Edit Access'
,
edit_admin_
project_member_path
(
@project
,
tm
),
class:
"btn small"
%td
=
link_to
'Remove from team'
,
admin_
team_member_path
(
tm
),
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn danger small"
%td
=
link_to
'Remove from team'
,
admin_
project_member_path
(
@project
,
tm
),
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn danger small"
%br
%br
%h5
Add new team member
%h5
Add new team member
...
...
app/views/admin/team_members/edit.html.haml
deleted
100644 → 0
View file @
497f7ab5
%p
.slead
Edit access for
=
link_to
@admin_team_member
.
user_name
,
admin_user_path
(
@admin_team_member
)
in
=
link_to
@admin_team_member
.
project
.
name_with_namespace
,
admin_project_path
(
@admin_team_member
)
%hr
=
render
'form'
config/routes.rb
View file @
1dd0feac
...
@@ -68,6 +68,9 @@ Gitlab::Application.routes.draw do
...
@@ -68,6 +68,9 @@ Gitlab::Application.routes.draw do
get
:team
get
:team
put
:team_update
put
:team_update
end
end
scope
module: :projects
do
resources
:members
,
only:
[
:edit
,
:update
,
:destroy
]
end
end
end
resources
:teams
do
#, constraints: { id: /[^\/]+/ } do end
resources
:teams
do
#, constraints: { id: /[^\/]+/ } do end
scope
module: :teams
do
scope
module: :teams
do
...
@@ -75,7 +78,6 @@ Gitlab::Application.routes.draw do
...
@@ -75,7 +78,6 @@ Gitlab::Application.routes.draw do
resources
:projects
,
only:
[
:edit
,
:update
,
:destroy
,
:new
,
:create
]
resources
:projects
,
only:
[
:edit
,
:update
,
:destroy
,
:new
,
:create
]
end
end
end
end
resources
:team_members
,
only:
[
:edit
,
:update
,
:destroy
]
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
]
do
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
]
do
get
:test
get
:test
end
end
...
...
spec/controllers/admin/projects/members_controller_spec.rb
0 → 100644
View file @
1dd0feac
require
'spec_helper'
describe
Admin
::
Projects
::
MembersController
do
describe
"GET 'edit'"
do
it
"returns http success"
do
get
'edit'
response
.
should
be_success
end
end
describe
"GET 'update'"
do
it
"returns http success"
do
get
'update'
response
.
should
be_success
end
end
describe
"GET 'destroy'"
do
it
"returns http success"
do
get
'destroy'
response
.
should
be_success
end
end
end
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