Remove unnecessary namespaced resource

This commit is contained in:
Dmitriy Zaporozhets 2013-06-26 15:02:28 +03:00
parent a5dbe35354
commit 112e919823
4 changed files with 10 additions and 31 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -88,9 +88,7 @@ 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
resources :members, only: [:destroy]
end
root to: "dashboard#index"