update all teams code. refactoring and some corrections
This commit is contained in:
parent
7658f8c151
commit
18bd1c9d30
35 changed files with 332 additions and 283 deletions
|
@ -1,7 +1,7 @@
|
|||
class Admin::Teams::ProjectsController < Admin::Teams::ApplicationController
|
||||
def new
|
||||
@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?)
|
||||
end
|
||||
|
||||
|
@ -9,10 +9,10 @@ class Admin::Teams::ProjectsController < Admin::Teams::ApplicationController
|
|||
unless params[:project_ids].blank?
|
||||
project_ids = params[:project_ids]
|
||||
access = params[:greatest_project_access]
|
||||
@team.assign_to_projects(project_ids, access)
|
||||
user_team.assign_to_projects(project_ids, access)
|
||||
end
|
||||
|
||||
redirect_to admin_team_path(@team), notice: 'Projects was successfully added.'
|
||||
redirect_to admin_team_path(user_team), notice: 'Team of users was successfully assgned to projects.'
|
||||
end
|
||||
|
||||
def edit
|
||||
|
@ -20,22 +20,22 @@ class Admin::Teams::ProjectsController < Admin::Teams::ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
if @team.update_project_access(team_project, params[:greatest_project_access])
|
||||
redirect_to admin_team_path(@team), notice: 'Membership was successfully updated.'
|
||||
if user_team.update_project_access(team_project, params[:greatest_project_access])
|
||||
redirect_to admin_team_path(user_team), notice: 'Access was successfully updated.'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@team.resign_from_project(team_project)
|
||||
redirect_to admin_team_path(@team), notice: 'Project was successfully removed.'
|
||||
user_team.resign_from_project(team_project)
|
||||
redirect_to admin_team_path(user_team), notice: 'Team of users was successfully reassigned from project.'
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def team_project
|
||||
@project ||= @team.projects.find_by_path(params[:id])
|
||||
@project ||= user_team.projects.find_with_namespace(params[:id])
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue