Commit a96cf3ad09c06fb5bfe668a77edc5d7adb2d092f
Committed by
Dmitriy Zaporozhets
1 parent
ea6f46cb
Exists in
master
and in
4 other branches
Team projects public section
Showing
6 changed files
with
69 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
| 1 | +class Teams::ProjectsController < Teams::ApplicationController | ||
| 2 | + def index | ||
| 3 | + @projects = @user_team.projects | ||
| 4 | + @avaliable_projects = current_user.admin? ? Project.without_team(@user_team) : (Project.personal(current_user) + current_user.projects).uniq | ||
| 5 | + end | ||
| 6 | + | ||
| 7 | + def new | ||
| 8 | + end | ||
| 9 | + | ||
| 10 | + def create | ||
| 11 | + end | ||
| 12 | + | ||
| 13 | + def edit | ||
| 14 | + end | ||
| 15 | + | ||
| 16 | + def update | ||
| 17 | + end | ||
| 18 | + | ||
| 19 | + def destroy | ||
| 20 | + end | ||
| 21 | +end |
| @@ -0,0 +1,34 @@ | @@ -0,0 +1,34 @@ | ||
| 1 | += render "teams/team_head" | ||
| 2 | + | ||
| 3 | +%fieldset | ||
| 4 | + %legend Projects (#{@user_team.projects.count}) | ||
| 5 | + = form_tag delegate_projects_team_path(@user_team), id: "team_projects", class: "bulk_import", method: :post do | ||
| 6 | + %table | ||
| 7 | + %thead | ||
| 8 | + %tr | ||
| 9 | + %th Project name | ||
| 10 | + %th Max access | ||
| 11 | + %th | ||
| 12 | + - @user_team.projects.each do |project| | ||
| 13 | + %tr.project | ||
| 14 | + %td | ||
| 15 | + = link_to project.name_with_namespace, project | ||
| 16 | + %td | ||
| 17 | + %span= @user_team.human_max_project_access(project) | ||
| 18 | + -# if current_user.can?(:manage_user_team, @user_team) | ||
| 19 | + - relation = project.user_team_project_relationships.find_by_user_team_id(@user_team) | ||
| 20 | + = form_for(relation, as: :project, url: team_project_path(@user_team, project)) do |f| | ||
| 21 | + = f.select :greatest_access, options_for_select(UsersProject.access_roles, @user_team.max_project_access(project)), {}, class: "medium project-access-select span2" | ||
| 22 | + | ||
| 23 | + - if current_user.can?(:admin_user_team, @user_team) | ||
| 24 | + %td.bgred | ||
| 25 | + -#= link_to 'Edit max access', edit_project_team_path(@user_team, project), class: "btn small" | ||
| 26 | + = 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" | ||
| 27 | + - else | ||
| 28 | + %td | ||
| 29 | + | ||
| 30 | + - if @avaliable_projects.any? | ||
| 31 | + %tr | ||
| 32 | + %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' | ||
| 33 | + %td= select_tag :greatest_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" } | ||
| 34 | + %td= submit_tag 'Add', class: "btn primary" |
config/routes.rb
| 1 | require 'sidekiq/web' | 1 | require 'sidekiq/web' |
| 2 | 2 | ||
| 3 | Gitlab::Application.routes.draw do | 3 | Gitlab::Application.routes.draw do |
| 4 | + | ||
| 4 | # | 5 | # |
| 5 | # Search | 6 | # Search |
| 6 | # | 7 | # |
| @@ -141,6 +142,7 @@ Gitlab::Application.routes.draw do | @@ -141,6 +142,7 @@ Gitlab::Application.routes.draw do | ||
| 141 | end | 142 | end |
| 142 | scope module: :teams do | 143 | scope module: :teams do |
| 143 | resources :members | 144 | resources :members |
| 145 | + resources :projects, only: [:index, :show] do | ||
| 144 | end | 146 | end |
| 145 | end | 147 | end |
| 146 | collection do | 148 | collection do |