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
Kazuhiko Shiozaki
gitlab-ce
Commits
f87b76a8
Commit
f87b76a8
authored
Jan 22, 2013
by
Andrey Kumanyaev
Committed by
Dmitriy Zaporozhets
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring user team in public section
parent
f6f414ce
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
6 deletions
+22
-6
app/controllers/teams/application_controller.rb
app/controllers/teams/application_controller.rb
+0
-2
app/controllers/teams/projects_controller.rb
app/controllers/teams/projects_controller.rb
+20
-2
app/helpers/user_teams_helper.rb
app/helpers/user_teams_helper.rb
+1
-1
app/views/teams/members/_show.html.haml
app/views/teams/members/_show.html.haml
+1
-1
No files found.
app/controllers/teams/application_controller.rb
View file @
f87b76a8
class
Teams::ApplicationController
<
ApplicationController
class
Teams::ApplicationController
<
ApplicationController
before_filter
:user_team
,
only:
[
:index
,
:show
,
:edit
,
:update
,
:destroy
,
:issues
,
:merge_requests
,
:search
,
:members
]
protected
protected
def
user_team
def
user_team
...
...
app/controllers/teams/projects_controller.rb
View file @
f87b76a8
class
Teams::ProjectsController
<
Teams
::
ApplicationController
class
Teams::ProjectsController
<
Teams
::
ApplicationController
def
index
def
index
@projects
=
@
user_team
.
projects
@projects
=
user_team
.
projects
@avaliable_projects
=
current_user
.
admin?
?
Project
.
without_team
(
@
user_team
)
:
(
Project
.
personal
(
current_user
)
+
current_user
.
projects
).
uniq
@avaliable_projects
=
current_user
.
admin?
?
Project
.
without_team
(
user_team
)
:
(
Project
.
personal
(
current_user
)
+
current_user
.
projects
).
uniq
end
end
def
new
def
new
@projects
=
Project
.
scoped
@projects
=
@projects
.
without_team
(
user_team
)
if
user_team
.
projects
.
any?
#@projects.reject!(&:empty_repo?)
end
end
def
create
def
create
unless
params
[
:project_ids
].
blank?
project_ids
=
params
[
:project_ids
]
access
=
params
[
:greatest_project_access
]
user_team
.
assign_to_projects
(
project_ids
,
access
)
end
redirect_to
admin_team_path
(
user_team
),
notice:
'Projects was successfully added.'
end
end
def
edit
def
edit
@user_team
=
user_team
end
end
def
update
def
update
if
user_team
.
update_project_access
(
project
,
params
[
:greatest_project_access
])
redirect_to
admin_team_path
(
user_team
),
notice:
'Membership was successfully updated.'
else
render
:edit
end
end
end
def
destroy
def
destroy
user_team
.
resign_from_project
(
project
)
redirect_to
admin_team_path
(
user_team
),
notice:
'Project was successfully removed.'
end
end
end
end
app/helpers/user_teams_helper.rb
View file @
f87b76a8
...
@@ -19,7 +19,7 @@ module UserTeamsHelper
...
@@ -19,7 +19,7 @@ module UserTeamsHelper
team
.
user_team_user_relationships
.
sort_by
(
&
:permission
).
reverse
.
group_by
(
&
:permission
)
team
.
user_team_user_relationships
.
sort_by
(
&
:permission
).
reverse
.
group_by
(
&
:permission
)
end
end
def
remove_from_team_message
(
team
,
member
)
def
remove_from_
user_
team_message
(
team
,
member
)
"You are going to remove
#{
member
.
name
}
from
#{
team
.
name
}
. Are you sure?"
"You are going to remove
#{
member
.
name
}
from
#{
team
.
name
}
. Are you sure?"
end
end
...
...
app/views/teams/members/_show.html.haml
View file @
f87b76a8
...
@@ -27,5 +27,5 @@
...
@@ -27,5 +27,5 @@
-
elsif
user
.
blocked
-
elsif
user
.
blocked
%span
.btn.disabled.blocked
Blocked
%span
.btn.disabled.blocked
Blocked
-
elsif
allow_admin
-
elsif
allow_admin
=
link_to
team_member_path
(
@user_team
,
user
),
confirm:
remove_from_team_message
(
@user_team
,
user
),
method: :delete
,
class:
"very_small btn danger"
do
=
link_to
team_member_path
(
@user_team
,
user
),
confirm:
remove_from_
user_
team_message
(
@user_team
,
user
),
method: :delete
,
class:
"very_small btn danger"
do
%i
.icon-minus.icon-white
%i
.icon-minus.icon-white
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