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
Jérome Perrin
gitlab-ce
Commits
61c74493
Commit
61c74493
authored
Sep 07, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bulk user add on project -> new team member
parent
963746f9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
23 deletions
+19
-23
app/controllers/team_members_controller.rb
app/controllers/team_members_controller.rb
+6
-7
app/views/team_members/_form.html.haml
app/views/team_members/_form.html.haml
+11
-14
features/step_definitions/project/project_team_steps.rb
features/step_definitions/project/project_team_steps.rb
+2
-2
No files found.
app/controllers/team_members_controller.rb
View file @
61c74493
...
...
@@ -17,13 +17,12 @@ class TeamMembersController < ApplicationController
end
def
create
@team_member
=
UsersProject
.
new
(
params
[
:team_member
])
@team_member
.
project
=
project
if
@team_member
.
save
@project
.
add_users_ids_to_team
(
params
[
:user_ids
],
params
[
:project_access
]
)
redirect_to
team_project_path
(
@project
)
else
render
"new"
end
end
def
update
...
...
app/views/team_members/_form.html.haml
View file @
61c74493
%h3
=
"New Team member"
%h3
.page_title
=
"New Team member(s)"
%hr
=
form_for
@team_member
,
as: :team_member
,
url:
project_team_members_path
(
@project
,
@team_member
)
do
|
f
|
-
if
@team_member
.
errors
.
any?
...
...
@@ -7,27 +8,23 @@
-
@team_member
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
%h6
1. Choose people you want in the team
.clearfix
=
f
.
label
:user_id
,
"Nam
e"
.input
=
f
.
select
(
:user_id
,
User
.
not_in_project
(
@project
).
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
include_blank:
"Select user"
},
{
style:
"width:300px"
})
=
f
.
label
:user_id
s
,
"Peolp
e"
.input
=
select_tag
(
:user_ids
,
options_from_collection_for_select
(
User
.
not_in_project
(
@project
).
all
,
:id
,
:name
),
{
class:
"xxlarge"
,
multiple:
true
})
%h6
2. Set access level for them
.clearfix
=
f
.
label
:project_access
,
"Project Access"
.input
=
f
.
select
:project_access
,
options_for_select
(
Project
.
access_options
,
@team_member
.
project_access
),
{}
,
class:
"project-access-select"
.input
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
,
@team_member
.
project_access
)
,
class:
"project-access-select"
.actions
=
f
.
submit
'Save'
,
class:
"btn
primary
"
=
link_to
"Cancel"
,
team_project_path
(
@project
),
class:
"btn"
=
f
.
submit
'Save'
,
class:
"btn
save-btn
"
=
link_to
"Cancel"
,
team_project_path
(
@project
),
class:
"btn
cancel-btn
"
:css
form
select
{
width
:
300px
;
}
:javascript
$
(
'
select#team_member_user_id
'
).
chosen
();
$
(
'
select#team_member_project_access
'
).
chosen
();
//$('select#team_member_repo_access').chosen();
//$('select#team_member_project_access').chosen();
$
(
'
select#user_ids
'
).
chosen
();
$
(
'
select#project_access
'
).
chosen
();
features/step_definitions/project/project_team_steps.rb
View file @
61c74493
...
...
@@ -22,8 +22,8 @@ end
Given
/^I select "(.*?)" as "(.*?)"$/
do
|
arg1
,
arg2
|
user
=
User
.
find_by_name
(
arg1
)
within
"#new_team_member"
do
select
user
.
name
,
:from
=>
"
team_member_user_id
"
select
arg2
,
:from
=>
"
team_member_
project_access"
select
user
.
name
,
:from
=>
"
user_ids
"
select
arg2
,
:from
=>
"project_access"
end
click_button
"Save"
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