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
31d84d71
Commit
31d84d71
authored
Jan 23, 2013
by
Andrey Kumanyaev
Committed by
Dmitriy Zaporozhets
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
assign team to project from project page in public section
parent
18bd1c9d
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
129 additions
and
3 deletions
+129
-3
app/controllers/projects/application_controller.rb
app/controllers/projects/application_controller.rb
+11
-0
app/controllers/projects/teams_controller.rb
app/controllers/projects/teams_controller.rb
+27
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+4
-0
app/models/user_team.rb
app/models/user_team.rb
+2
-0
app/models/user_team_project_relationship.rb
app/models/user_team_project_relationship.rb
+4
-0
app/views/projects/_project_head.html.haml
app/views/projects/_project_head.html.haml
+1
-1
app/views/projects/teams/avaliable.html.haml
app/views/projects/teams/avaliable.html.haml
+22
-0
app/views/team_members/_show_team.html.haml
app/views/team_members/_show_team.html.haml
+15
-0
app/views/team_members/_teams.html.haml
app/views/team_members/_teams.html.haml
+16
-0
app/views/team_members/import.html.haml
app/views/team_members/import.html.haml
+1
-1
app/views/team_members/index.html.haml
app/views/team_members/index.html.haml
+14
-1
config/routes.rb
config/routes.rb
+12
-0
No files found.
app/controllers/projects/application_controller.rb
0 → 100644
View file @
31d84d71
class
Projects::ApplicationController
<
ApplicationController
before_filter
:authorize_admin_team_member!
protected
def
user_team
@team
||=
UserTeam
.
find_by_path
(
params
[
:id
])
end
end
app/controllers/projects/teams_controller.rb
0 → 100644
View file @
31d84d71
class
Projects::TeamsController
<
Projects
::
ApplicationController
def
avaliable
@teams
=
current_user
.
is_admin?
?
UserTeam
.
scoped
:
current_user
.
user_teams
@teams
=
@teams
.
without_project
(
project
)
unless
@teams
.
any?
redirect_to
project_team_index_path
(
project
),
notice:
"No avaliable teams for assigment."
end
end
def
assign
unless
params
[
:team_id
].
blank?
team
=
UserTeam
.
find
(
params
[
:team_id
])
access
=
params
[
:greatest_project_access
]
team
.
assign_to_project
(
project
,
access
)
end
redirect_to
project_team_index_path
(
project
)
end
def
resign
team
=
project
.
user_teams
.
find_by_path
(
params
[
:id
])
team
.
resign_from_project
(
project
)
redirect_to
project_team_index_path
(
project
)
end
end
app/helpers/projects_helper.rb
View file @
31d84d71
...
@@ -3,6 +3,10 @@ module ProjectsHelper
...
@@ -3,6 +3,10 @@ module ProjectsHelper
@project
.
users_projects
.
sort_by
(
&
:project_access
).
reverse
.
group_by
(
&
:project_access
)
@project
.
users_projects
.
sort_by
(
&
:project_access
).
reverse
.
group_by
(
&
:project_access
)
end
end
def
grouper_project_teams
(
project
)
@project
.
user_team_project_relationships
.
sort_by
(
&
:greatest_access
).
reverse
.
group_by
(
&
:greatest_access
)
end
def
remove_from_project_team_message
(
project
,
user
)
def
remove_from_project_team_message
(
project
,
user
)
"You are going to remove
#{
user
.
name
}
from
#{
project
.
name
}
project team. Are you sure?"
"You are going to remove
#{
user
.
name
}
from
#{
project
.
name
}
project team. Are you sure?"
end
end
...
...
app/models/user_team.rb
View file @
31d84d71
...
@@ -16,6 +16,8 @@ class UserTeam < ActiveRecord::Base
...
@@ -16,6 +16,8 @@ class UserTeam < ActiveRecord::Base
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
scope
:with_member
,
->
(
user
){
joins
(
:user_team_user_relationships
).
where
(
user_team_user_relationships:
{
user_id:
user
.
id
})
}
scope
:with_member
,
->
(
user
){
joins
(
:user_team_user_relationships
).
where
(
user_team_user_relationships:
{
user_id:
user
.
id
})
}
scope
:with_project
,
->
(
project
){
joins
(
:user_team_project_relationships
).
where
(
user_team_project_relationships:
{
project_id:
project
})}
scope
:without_project
,
->
(
project
){
where
(
"id NOT IN (:ids)"
,
ids:
with_project
(
project
))}
scope
:created_by
,
->
(
user
){
where
(
owner_id:
user
)
}
scope
:created_by
,
->
(
user
){
where
(
owner_id:
user
)
}
class
<<
self
class
<<
self
...
...
app/models/user_team_project_relationship.rb
View file @
31d84d71
...
@@ -10,6 +10,10 @@ class UserTeamProjectRelationship < ActiveRecord::Base
...
@@ -10,6 +10,10 @@ class UserTeamProjectRelationship < ActiveRecord::Base
scope
:with_project
,
->
(
project
){
where
(
project_id:
project
.
id
)
}
scope
:with_project
,
->
(
project
){
where
(
project_id:
project
.
id
)
}
def
team_name
user_team
.
name
end
private
private
def
check_greatest_access
def
check_greatest_access
...
...
app/views/projects/_project_head.html.haml
View file @
31d84d71
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
=
link_to
project_path
(
@project
),
class:
"activities-tab tab"
do
=
link_to
project_path
(
@project
),
class:
"activities-tab tab"
do
%i
.icon-home
%i
.icon-home
Show
Show
=
nav_link
(
controller:
:team_members
)
do
=
nav_link
(
controller:
[
:team_members
,
:teams
]
)
do
=
link_to
project_team_index_path
(
@project
),
class:
"team-tab tab"
do
=
link_to
project_team_index_path
(
@project
),
class:
"team-tab tab"
do
%i
.icon-user
%i
.icon-user
Team
Team
...
...
app/views/projects/teams/avaliable.html.haml
0 → 100644
View file @
31d84d71
=
render
"projects/project_head"
%h3
.page_title
=
"Assign project to team of users"
%hr
%p
.slead
Read more about assign to team of users
#{
link_to
"here"
,
'#'
,
class:
'vlink'
}
.
=
form_tag
assign_project_teams_path
(
@project
),
method:
'post'
do
%p
.slead
Choose Team of users you want to assign:
.padded
=
label_tag
:team_id
,
"Team"
.input
=
select_tag
(
:team_id
,
options_from_collection_for_select
(
@teams
,
:id
,
:name
),
prompt:
"Select team"
,
class:
"chosen xxlarge"
,
required:
true
)
%p
.slead
Choose greatest user acces in team you want to assign:
.padded
=
label_tag
:team_ids
,
"Permission"
.input
=
select_tag
:greatest_project_access
,
options_for_select
(
UserTeam
.
access_roles
),
{
class:
"project-access-select chosen span3"
}
.actions
=
submit_tag
'Assign'
,
class:
"btn save-btn"
=
link_to
"Cancel"
,
project_team_index_path
(
@project
),
class:
"btn cancel-btn"
app/views/team_members/_show_team.html.haml
0 → 100644
View file @
31d84d71
-
team
=
team_rel
.
user_team
-
allow_admin
=
can?
current_user
,
:admin_team_member
,
@project
%li
{
id:
dom_id
(
team
),
class:
"user_team_row team_#{team.id}"
}
.row
.span6
%strong
=
link_to
team
.
name
,
team_path
(
team
),
title:
team
.
name
,
class:
"dark"
%br
%small
.cgray
Members:
#{
team
.
members
.
count
}
.span5.right
.right
-
if
allow_admin
.left
=
link_to
resign_project_team_path
(
@project
,
team
),
method: :delete
,
confirm:
"Are you shure?"
,
class:
"btn danger small"
do
%i
.icon-minus.icon-white
app/views/team_members/_teams.html.haml
0 → 100644
View file @
31d84d71
-
grouper_project_teams
(
@project
).
each
do
|
access
,
teams
|
.ui-box
%h5
.title
=
UserTeam
.
access_roles
.
key
(
access
).
pluralize
%small
=
teams
.
size
%ul
.well-list
-
teams
.
sort_by
(
&
:team_name
).
each
do
|
tofr
|
=
render
(
partial:
'team_members/show_team'
,
locals:
{
team_rel:
tofr
})
:javascript
$
(
function
(){
$
(
'
.repo-access-select, .project-access-select
'
).
live
(
"
change
"
,
function
()
{
$
(
this
.
form
).
submit
();
});
})
app/views/team_members/import.html.haml
View file @
31d84d71
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
=
"Import team from another project"
=
"Import team from another project"
%hr
%hr
%p
.slead
%p
.slead
Read more about team import
#{
link_to
"here"
,
'#'
,
class:
'vlink'
}
.
Read more about
project
team import
#{
link_to
"here"
,
'#'
,
class:
'vlink'
}
.
=
form_tag
apply_import_project_team_members_path
(
@project
),
method:
'post'
do
=
form_tag
apply_import_project_team_members_path
(
@project
),
method:
'post'
do
%p
.slead
Choose project you want to use as team source:
%p
.slead
Choose project you want to use as team source:
.padded
.padded
...
...
app/views/team_members/index.html.haml
View file @
31d84d71
...
@@ -10,11 +10,24 @@
...
@@ -10,11 +10,24 @@
%span
.right
%span
.right
=
link_to
import_project_team_members_path
(
@project
),
class:
"btn small grouped"
,
title:
"Import team from another project"
do
=
link_to
import_project_team_members_path
(
@project
),
class:
"btn small grouped"
,
title:
"Import team from another project"
do
Import team from another project
Import team from another project
=
link_to
avaliable_project_teams_path
(
@project
),
class:
"btn small grouped"
,
title:
"Assign project to team of users"
do
Assign project to Team of users
=
link_to
new_project_team_member_path
(
@project
),
class:
"btn success small grouped"
,
title:
"New Team Member"
do
=
link_to
new_project_team_member_path
(
@project
),
class:
"btn success small grouped"
,
title:
"New Team Member"
do
New Team Member
New Team Member
%hr
%hr
.clearfix
.clearfix
%div
.team-table
%div
.team-table
=
render
partial:
"team_members/team"
,
locals:
{
project:
@project
}
=
render
partial:
"team_members/team"
,
locals:
{
project:
@project
}
%h3
.page_title
Assigned teams
(
#{
@project
.
user_teams
.
count
}
)
%hr
.clearfix
%div
.team-table
=
render
partial:
"team_members/teams"
,
locals:
{
project:
@project
}
config/routes.rb
View file @
31d84d71
...
@@ -269,6 +269,18 @@ Gitlab::Application.routes.draw do
...
@@ -269,6 +269,18 @@ Gitlab::Application.routes.draw do
end
end
end
end
scope
module: :projects
do
resources
:teams
,
only:
[]
do
collection
do
get
:avaliable
post
:assign
end
member
do
delete
:resign
end
end
end
resources
:notes
,
only:
[
:index
,
:create
,
:destroy
]
do
resources
:notes
,
only:
[
:index
,
:create
,
:destroy
]
do
collection
do
collection
do
post
:preview
post
:preview
...
...
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