Remove unnecessary namespaced resource
This commit is contained in:
parent
a5dbe35354
commit
112e919823
|
@ -0,0 +1,9 @@
|
|||
class Admin::MembersController < Admin::ApplicationController
|
||||
def destroy
|
||||
user = User.find_by_username(params[:id])
|
||||
project = Project.find_with_namespace(params[:project_id])
|
||||
project.users_projects.where(user_id: user).first.destroy
|
||||
|
||||
redirect_to :back
|
||||
end
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
# Provides a base class for Admin controllers to subclass
|
||||
#
|
||||
# Automatically sets the layout and ensures an administrator is logged in
|
||||
class Admin::Projects::ApplicationController < Admin::ApplicationController
|
||||
|
||||
protected
|
||||
|
||||
def project
|
||||
@project ||= Project.find_with_namespace(params[:project_id])
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
class Admin::Projects::MembersController < Admin::Projects::ApplicationController
|
||||
def destroy
|
||||
team_member_relation.destroy
|
||||
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def team_member
|
||||
@member ||= project.users.find_by_username(params[:id])
|
||||
end
|
||||
|
||||
def team_member_relation
|
||||
team_member.users_projects.find_by_project_id(project)
|
||||
end
|
||||
end
|
|
@ -88,10 +88,8 @@ Gitlab::Application.routes.draw do
|
|||
resource :background_jobs, controller: 'background_jobs', only: [:show]
|
||||
|
||||
resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] do
|
||||
scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
|
||||
resources :members, only: [:destroy]
|
||||
end
|
||||
end
|
||||
|
||||
root to: "dashboard#index"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue