diff --git a/app/controllers/teams/projects_controller.rb b/app/controllers/teams/projects_controller.rb new file mode 100644 index 00000000000..796f37f6d5d --- /dev/null +++ b/app/controllers/teams/projects_controller.rb @@ -0,0 +1,21 @@ +class Teams::ProjectsController < Teams::ApplicationController + def index + @projects = @user_team.projects + @avaliable_projects = current_user.admin? ? Project.without_team(@user_team) : (Project.personal(current_user) + current_user.projects).uniq + end + + def new + end + + def create + end + + def edit + end + + def update + end + + def destroy + end +end diff --git a/app/views/teams/projects/edit.html.haml b/app/views/teams/projects/edit.html.haml new file mode 100644 index 00000000000..66c9f0671ff --- /dev/null +++ b/app/views/teams/projects/edit.html.haml @@ -0,0 +1,4 @@ += render "teams/team_head" + +%h1 Teams::Projects#edit +%p Find me in app/views/teams/projects/edit.html.haml diff --git a/app/views/teams/projects/index.html.haml b/app/views/teams/projects/index.html.haml new file mode 100644 index 00000000000..66cb12a8421 --- /dev/null +++ b/app/views/teams/projects/index.html.haml @@ -0,0 +1,34 @@ += render "teams/team_head" + +%fieldset + %legend Projects (#{@user_team.projects.count}) + = form_tag delegate_projects_team_path(@user_team), id: "team_projects", class: "bulk_import", method: :post do + %table + %thead + %tr + %th Project name + %th Max access + %th + - @user_team.projects.each do |project| + %tr.project + %td + = link_to project.name_with_namespace, project + %td + %span= @user_team.human_max_project_access(project) + -# if current_user.can?(:manage_user_team, @user_team) + - relation = project.user_team_project_relationships.find_by_user_team_id(@user_team) + = form_for(relation, as: :project, url: team_project_path(@user_team, project)) do |f| + = f.select :greatest_access, options_for_select(UsersProject.access_roles, @user_team.max_project_access(project)), {}, class: "medium project-access-select span2" + + - if current_user.can?(:admin_user_team, @user_team) + %td.bgred + -#= link_to 'Edit max access', edit_project_team_path(@user_team, project), class: "btn small" + = link_to 'Relegate', relegate_project_team_path(@user_team, project_id: project.id), confirm: 'Remove project from team and move to global namespace. Are you sure?', method: :delete, class: "btn danger small" + - else + %td + + - if @avaliable_projects.any? + %tr + %td= select_tag :project_ids, options_from_collection_for_select(@avaliable_projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span5' + %td= select_tag :greatest_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" } + %td= submit_tag 'Add', class: "btn primary" diff --git a/app/views/teams/projects/new.html.haml b/app/views/teams/projects/new.html.haml new file mode 100644 index 00000000000..24d2d4c34ca --- /dev/null +++ b/app/views/teams/projects/new.html.haml @@ -0,0 +1,4 @@ += render "teams/team_head" + +%h1 Teams::Projects#new +%p Find me in app/views/teams/projects/new.html.haml diff --git a/app/views/teams/projects/show.html.haml b/app/views/teams/projects/show.html.haml new file mode 100644 index 00000000000..66c9f0671ff --- /dev/null +++ b/app/views/teams/projects/show.html.haml @@ -0,0 +1,4 @@ += render "teams/team_head" + +%h1 Teams::Projects#edit +%p Find me in app/views/teams/projects/edit.html.haml diff --git a/config/routes.rb b/config/routes.rb index 44678ca0266..69ad2e68642 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,7 @@ require 'sidekiq/web' Gitlab::Application.routes.draw do + # # Search # @@ -141,6 +142,7 @@ Gitlab::Application.routes.draw do end scope module: :teams do resources :members + resources :projects, only: [:index, :show] do end end collection do