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
fa8c0c78
Commit
fa8c0c78
authored
Jan 21, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Admin area: add multiple users to project
parent
f6f72d4b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
1 deletion
+69
-1
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+18
-0
app/models/users_project.rb
app/models/users_project.rb
+14
-0
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+1
-0
app/views/admin/projects/team.html.haml
app/views/admin/projects/team.html.haml
+30
-0
config/routes.rb
config/routes.rb
+6
-1
No files found.
app/controllers/admin/projects_controller.rb
View file @
fa8c0c78
...
@@ -19,6 +19,24 @@ class Admin::ProjectsController < ApplicationController
...
@@ -19,6 +19,24 @@ class Admin::ProjectsController < ApplicationController
@admin_project
=
Project
.
find_by_code
(
params
[
:id
])
@admin_project
=
Project
.
find_by_code
(
params
[
:id
])
end
end
def
team
@admin_project
=
Project
.
find_by_code
(
params
[
:id
])
@users
=
User
.
not_in_project
(
@admin_project
).
all
end
def
team_update
@admin_project
=
Project
.
find_by_code
(
params
[
:id
])
UsersProject
.
bulk_import
(
@admin_project
,
params
[
:user_ids
],
params
[
:project_access
],
params
[
:repo_access
]
)
redirect_to
[
:admin
,
@admin_project
],
notice:
'Project was successfully updated.'
end
def
create
def
create
@admin_project
=
Project
.
new
(
params
[
:project
])
@admin_project
=
Project
.
new
(
params
[
:project
])
@admin_project
.
owner
=
current_user
@admin_project
.
owner
=
current_user
...
...
app/models/users_project.rb
View file @
fa8c0c78
...
@@ -13,6 +13,20 @@ class UsersProject < ActiveRecord::Base
...
@@ -13,6 +13,20 @@ class UsersProject < ActiveRecord::Base
delegate
:name
,
:email
,
:to
=>
:user
,
:prefix
=>
true
delegate
:name
,
:email
,
:to
=>
:user
,
:prefix
=>
true
def
self
.
bulk_import
(
project
,
user_ids
,
project_access
,
repo_access
)
UsersProject
.
transaction
do
user_ids
.
each
do
|
user_id
|
users_project
=
UsersProject
.
new
(
:repo_access
=>
repo_access
,
:project_access
=>
project_access
,
:user_id
=>
user_id
)
users_project
.
project
=
project
users_project
.
save
end
end
end
def
update_repository
def
update_repository
Gitlabhq
::
GitHost
.
system
.
new
.
configure
do
|
c
|
Gitlabhq
::
GitHost
.
system
.
new
.
configure
do
|
c
|
c
.
update_project
(
project
.
path
,
project
)
c
.
update_project
(
project
.
path
,
project
)
...
...
app/views/admin/projects/show.html.haml
View file @
fa8c0c78
...
@@ -57,3 +57,4 @@
...
@@ -57,3 +57,4 @@
%td
=
link_to
'Destroy'
,
admin_team_member_path
(
tm
),
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
%td
=
link_to
'Destroy'
,
admin_team_member_path
(
tm
),
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
=
link_to
'New Team Member'
,
new_admin_team_member_path
(
:team_member
=>
{
:project_id
=>
@admin_project
.
id
}),
:class
=>
"grey-button"
=
link_to
'New Team Member'
,
new_admin_team_member_path
(
:team_member
=>
{
:project_id
=>
@admin_project
.
id
}),
:class
=>
"grey-button"
.right
=
link_to
'Bulk Import'
,
team_admin_project_path
(
@admin_project
),
:class
=>
"grey-button"
app/views/admin/projects/team.html.haml
0 → 100644
View file @
fa8c0c78
=
form_tag
team_update_admin_project_path
(
@admin_project
),
:class
=>
"bulk_import"
,
:method
=>
:put
do
.span-6
%b
Project Access:
.span-6
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
),
:class
=>
"project-access-select"
.span-6
%b
Repository Access:
.span-6
=
select_tag
:repo_access
,
options_for_select
(
Repository
.
access_options
),
:class
=>
"repo-access-select"
%br
=
select_tag
:user_ids
,
options_from_collection_for_select
(
@users
,
:id
,
:name
),
:multiple
=>
true
%br
.clear
%br
.actions
=
submit_tag
'Save'
,
:class
=>
"grey-button"
:css
form
select
{
width
:
300px
;
}
:javascript
$
(
'
select#user_ids
'
).
chosen
();
$
(
'
select#repo_access
'
).
chosen
();
$
(
'
select#project_access
'
).
chosen
();
config/routes.rb
View file @
fa8c0c78
...
@@ -10,7 +10,12 @@ Gitlab::Application.routes.draw do
...
@@ -10,7 +10,12 @@ Gitlab::Application.routes.draw do
namespace
:admin
do
namespace
:admin
do
resources
:users
resources
:users
resources
:projects
,
:constraints
=>
{
:id
=>
/[^\/]+/
}
resources
:projects
,
:constraints
=>
{
:id
=>
/[^\/]+/
}
do
member
do
get
:team
put
:team_update
end
end
resources
:team_members
resources
:team_members
get
'emails'
,
:to
=>
'mailer#preview'
get
'emails'
,
:to
=>
'mailer#preview'
get
'mailer/preview_note'
get
'mailer/preview_note'
...
...
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