2013-01-21 20:55:55 +01:00
|
|
|
class Admin::Projects::MembersController < Admin::Projects::ApplicationController
|
|
|
|
def edit
|
|
|
|
@member = team_member
|
|
|
|
@project = project
|
|
|
|
@team_member_relation = team_member_relation
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
if team_member_relation.update_attributes(params[:team_member])
|
|
|
|
redirect_to [:admin, project], notice: 'Project Access was successfully updated.'
|
|
|
|
else
|
|
|
|
render action: "edit"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
team_member_relation.destroy
|
|
|
|
|
|
|
|
redirect_to :back
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def team_member
|
2013-01-25 18:20:15 +01:00
|
|
|
@member ||= project.users.find_by_username(params[:id])
|
2013-01-21 20:55:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def team_member_relation
|
|
|
|
team_member.users_projects.find_by_project_id(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|