assign team to project from project page in public section
This commit is contained in:
parent
18bd1c9d30
commit
31d84d71d3
12 changed files with 129 additions and 3 deletions
11
app/controllers/projects/application_controller.rb
Normal file
11
app/controllers/projects/application_controller.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class Projects::ApplicationController < ApplicationController
|
||||
|
||||
before_filter :authorize_admin_team_member!
|
||||
|
||||
protected
|
||||
|
||||
def user_team
|
||||
@team ||= UserTeam.find_by_path(params[:id])
|
||||
end
|
||||
|
||||
end
|
27
app/controllers/projects/teams_controller.rb
Normal file
27
app/controllers/projects/teams_controller.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
class Projects::TeamsController < Projects::ApplicationController
|
||||
|
||||
def avaliable
|
||||
@teams = current_user.is_admin? ? UserTeam.scoped : current_user.user_teams
|
||||
@teams = @teams.without_project(project)
|
||||
unless @teams.any?
|
||||
redirect_to project_team_index_path(project), notice: "No avaliable teams for assigment."
|
||||
end
|
||||
end
|
||||
|
||||
def assign
|
||||
unless params[:team_id].blank?
|
||||
team = UserTeam.find(params[:team_id])
|
||||
access = params[:greatest_project_access]
|
||||
team.assign_to_project(project, access)
|
||||
end
|
||||
redirect_to project_team_index_path(project)
|
||||
end
|
||||
|
||||
def resign
|
||||
team = project.user_teams.find_by_path(params[:id])
|
||||
team.resign_from_project(project)
|
||||
|
||||
redirect_to project_team_index_path(project)
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue