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
1
Merge Requests
1
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
nexedi
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
...
@@ -17,13 +17,12 @@ class TeamMembersController < ApplicationController
end
end
def
create
def
create
@team_member
=
UsersProject
.
new
(
params
[
:team_member
])
@project
.
add_users_ids_to_team
(
@team_member
.
project
=
project
params
[
:user_ids
],
if
@team_member
.
save
params
[
:project_access
]
)
redirect_to
team_project_path
(
@project
)
redirect_to
team_project_path
(
@project
)
else
render
"new"
end
end
end
def
update
def
update
...
...
app/views/team_members/_form.html.haml
View file @
61c74493
%h3
=
"New Team member"
%h3
.page_title
=
"New Team member(s)"
%hr
%hr
=
form_for
@team_member
,
as: :team_member
,
url:
project_team_members_path
(
@project
,
@team_member
)
do
|
f
|
=
form_for
@team_member
,
as: :team_member
,
url:
project_team_members_path
(
@project
,
@team_member
)
do
|
f
|
-
if
@team_member
.
errors
.
any?
-
if
@team_member
.
errors
.
any?
...
@@ -7,27 +8,23 @@
...
@@ -7,27 +8,23 @@
-
@team_member
.
errors
.
full_messages
.
each
do
|
msg
|
-
@team_member
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
%li
=
msg
%h6
1. Choose people you want in the team
.clearfix
.clearfix
=
f
.
label
:user_id
,
"Nam
e"
=
f
.
label
:user_id
s
,
"Peolp
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"
})
.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
.clearfix
=
f
.
label
:project_access
,
"Project Access"
=
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
.actions
=
f
.
submit
'Save'
,
class:
"btn
primary
"
=
f
.
submit
'Save'
,
class:
"btn
save-btn
"
=
link_to
"Cancel"
,
team_project_path
(
@project
),
class:
"btn"
=
link_to
"Cancel"
,
team_project_path
(
@project
),
class:
"btn
cancel-btn
"
:css
form
select
{
width
:
300px
;
}
:javascript
:javascript
$
(
'
select#team_member_user_id
'
).
chosen
();
$
(
'
select#user_ids
'
).
chosen
();
$
(
'
select#team_member_project_access
'
).
chosen
();
$
(
'
select#project_access
'
).
chosen
();
//$('select#team_member_repo_access').chosen();
//$('select#team_member_project_access').chosen();
features/step_definitions/project/project_team_steps.rb
View file @
61c74493
...
@@ -22,8 +22,8 @@ end
...
@@ -22,8 +22,8 @@ end
Given
/^I select "(.*?)" as "(.*?)"$/
do
|
arg1
,
arg2
|
Given
/^I select "(.*?)" as "(.*?)"$/
do
|
arg1
,
arg2
|
user
=
User
.
find_by_name
(
arg1
)
user
=
User
.
find_by_name
(
arg1
)
within
"#new_team_member"
do
within
"#new_team_member"
do
select
user
.
name
,
:from
=>
"
team_member_user_id
"
select
user
.
name
,
:from
=>
"
user_ids
"
select
arg2
,
:from
=>
"
team_member_
project_access"
select
arg2
,
:from
=>
"project_access"
end
end
click_button
"Save"
click_button
"Save"
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