Commit a96cf3ad authored by Andrey Kumanyaev's avatar Andrey Kumanyaev Committed by Dmitriy Zaporozhets

Team projects public section

parent ea6f46cb
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
= render "teams/team_head"
%h1 Teams::Projects#edit
%p Find me in app/views/teams/projects/edit.html.haml
= 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"
= render "teams/team_head"
%h1 Teams::Projects#new
%p Find me in app/views/teams/projects/new.html.haml
= render "teams/team_head"
%h1 Teams::Projects#edit
%p Find me in app/views/teams/projects/edit.html.haml
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment