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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
dcea5220
Commit
dcea5220
authored
Jan 22, 2013
by
Andrey Kumanyaev
Committed by
Dmitriy Zaporozhets
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove before_filter from controllers
parent
f87b76a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
33 deletions
+34
-33
app/controllers/admin/teams/members_controller.rb
app/controllers/admin/teams/members_controller.rb
+5
-6
app/controllers/admin/teams/projects_controller.rb
app/controllers/admin/teams/projects_controller.rb
+5
-6
app/controllers/admin/teams_controller.rb
app/controllers/admin/teams_controller.rb
+14
-18
app/controllers/teams/projects_controller.rb
app/controllers/teams/projects_controller.rb
+10
-3
No files found.
app/controllers/admin/teams/members_controller.rb
View file @
dcea5220
class
Admin::Teams::MembersController
<
Admin
::
Teams
::
ApplicationController
before_filter
:team_member
,
only:
[
:edit
,
:destroy
,
:update
]
def
new
@users
=
User
.
active
@users
=
@users
.
not_in_team
(
@team
)
if
@team
.
members
.
any?
...
...
@@ -19,11 +17,12 @@ class Admin::Teams::MembersController < Admin::Teams::ApplicationController
end
def
edit
team_member
end
def
update
options
=
{
default_projects_access:
params
[
:default_project_access
],
group_admin:
params
[
:group_admin
]}
if
@team
.
update_membership
(
@
member
,
options
)
if
@team
.
update_membership
(
team_
member
,
options
)
redirect_to
admin_team_path
(
@team
),
notice:
'Membership was successfully updated.'
else
render
:edit
...
...
@@ -31,16 +30,16 @@ class Admin::Teams::MembersController < Admin::Teams::ApplicationController
end
def
destroy
if
@team
.
remove_member
(
@
member
)
if
@team
.
remove_member
(
team_
member
)
redirect_to
admin_team_path
(
@team
),
notice:
"Member was successfully removed from team."
else
redirect_to
admin_team_members
(
@team
),
notice:
"Something wrong."
end
end
pr
ivate
pr
otected
def
team_member
@member
=
@team
.
members
.
find
(
params
[
:id
])
@member
||
=
@team
.
members
.
find
(
params
[
:id
])
end
end
app/controllers/admin/teams/projects_controller.rb
View file @
dcea5220
class
Admin::Teams::ProjectsController
<
Admin
::
Teams
::
ApplicationController
before_filter
:team_project
,
only:
[
:edit
,
:destroy
,
:update
]
def
new
@projects
=
Project
.
scoped
@projects
=
@projects
.
without_team
(
@team
)
if
@team
.
projects
.
any?
...
...
@@ -18,10 +16,11 @@ class Admin::Teams::ProjectsController < Admin::Teams::ApplicationController
end
def
edit
team_project
end
def
update
if
@team
.
update_project_access
(
@
project
,
params
[
:greatest_project_access
])
if
@team
.
update_project_access
(
team_
project
,
params
[
:greatest_project_access
])
redirect_to
admin_team_path
(
@team
),
notice:
'Membership was successfully updated.'
else
render
:edit
...
...
@@ -29,14 +28,14 @@ class Admin::Teams::ProjectsController < Admin::Teams::ApplicationController
end
def
destroy
@team
.
resign_from_project
(
@
project
)
@team
.
resign_from_project
(
team_
project
)
redirect_to
admin_team_path
(
@team
),
notice:
'Project was successfully removed.'
end
pr
ivate
pr
otected
def
team_project
@project
=
@team
.
projects
.
find_by_path
(
params
[
:id
])
@project
||
=
@team
.
projects
.
find_by_path
(
params
[
:id
])
end
end
app/controllers/admin/teams_controller.rb
View file @
dcea5220
class
Admin::TeamsController
<
Admin
::
ApplicationController
before_filter
:user_team
,
only:
[
:edit
,
:show
,
:update
,
:destroy
,
:delegate_projects
,
:relegate_project
,
:add_members
,
:remove_member
]
def
index
@teams
=
UserTeam
.
order
(
'name ASC'
)
@teams
=
@teams
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
...
...
@@ -12,11 +7,11 @@ class Admin::TeamsController < Admin::ApplicationController
def
show
@projects
=
Project
.
scoped
@projects
=
@projects
.
without_team
(
@team
)
if
@
team
.
projects
.
any?
@projects
=
@projects
.
without_team
(
user_team
)
if
user_
team
.
projects
.
any?
#@projects.reject!(&:empty_repo?)
@users
=
User
.
active
@users
=
@users
.
not_in_team
(
@team
)
if
@
team
.
members
.
any?
@users
=
@users
.
not_in_team
(
user_team
)
if
user_
team
.
members
.
any?
@users
=
UserDecorator
.
decorate
@users
end
...
...
@@ -25,15 +20,16 @@ class Admin::TeamsController < Admin::ApplicationController
end
def
edit
user_team
end
def
create
@
team
=
UserTeam
.
new
(
params
[
:user_team
])
@team
.
path
=
@team
.
name
.
dup
.
parameterize
if
@
team
.
name
@
team
.
owner
=
current_user
user_
team
=
UserTeam
.
new
(
params
[
:user_team
])
user_team
.
path
=
user_team
.
name
.
dup
.
parameterize
if
user_
team
.
name
user_
team
.
owner
=
current_user
if
@
team
.
save
redirect_to
admin_team_path
(
@
team
),
notice:
'UserTeam was successfully created.'
if
user_
team
.
save
redirect_to
admin_team_path
(
user_
team
),
notice:
'UserTeam was successfully created.'
else
render
action:
"new"
end
...
...
@@ -44,26 +40,26 @@ class Admin::TeamsController < Admin::ApplicationController
owner_id
=
user_team_params
.
delete
(
:owner_id
)
if
owner_id
@
team
.
owner
=
User
.
find
(
owner_id
)
user_
team
.
owner
=
User
.
find
(
owner_id
)
end
if
@
team
.
update_attributes
(
user_team_params
)
redirect_to
admin_team_path
(
@
team
),
notice:
'UserTeam was successfully updated.'
if
user_
team
.
update_attributes
(
user_team_params
)
redirect_to
admin_team_path
(
user_
team
),
notice:
'UserTeam was successfully updated.'
else
render
action:
"edit"
end
end
def
destroy
@
team
.
destroy
user_
team
.
destroy
redirect_to
admin_user_teams_path
,
notice:
'UserTeam was successfully deleted.'
end
pr
ivate
pr
otected
def
user_team
@team
=
UserTeam
.
find_by_path
(
params
[
:id
])
@team
||
=
UserTeam
.
find_by_path
(
params
[
:id
])
end
end
app/controllers/teams/projects_controller.rb
View file @
dcea5220
...
...
@@ -21,11 +21,11 @@ class Teams::ProjectsController < Teams::ApplicationController
end
def
edit
@user_team
=
user_team
team_project
end
def
update
if
user_team
.
update_project_access
(
project
,
params
[
:greatest_project_access
])
if
user_team
.
update_project_access
(
team_
project
,
params
[
:greatest_project_access
])
redirect_to
admin_team_path
(
user_team
),
notice:
'Membership was successfully updated.'
else
render
:edit
...
...
@@ -33,7 +33,14 @@ class Teams::ProjectsController < Teams::ApplicationController
end
def
destroy
user_team
.
resign_from_project
(
project
)
user_team
.
resign_from_project
(
team_
project
)
redirect_to
admin_team_path
(
user_team
),
notice:
'Project was successfully removed.'
end
private
def
team_project
@project
||=
@team
.
projects
.
find_by_path
(
params
[
:id
])
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