%h3.page_title
  Assigned projects (#{@team.projects.count})
  %small
    Read more about project permissions
    %strong= link_to "here", help_permissions_path, class: "vlink"

  - if current_user.can?(:manage_user_team, @team) && @avaliable_projects.any?
    %span.pull-right
      = link_to new_team_project_path(@team), class: "btn btn-primary small grouped", title: "New Team Member" do
        Assign project to Team

%hr

- if @team.projects.present?
  %table.projects-table
    %thead
      %tr
        %th Project name
        %th Max access
        - if current_user.can?(:admin_user_team, @team)
          %th.span3

    - @team.projects.each do |project|
      %tr.project
        %td
          = link_to project.name_with_namespace, project_path(project)
        %td
          %span= @team.human_max_project_access(project)

        - if current_user.can?(:admin_user_team, @team)
          %td.bgred
            = link_to 'Edit max access', edit_team_project_path(@team, project), class: "btn btn-small"
            = link_to 'Relegate', team_project_path(@team, project), confirm: 'Remove project from team and move to global namespace. Are you sure?', method: :delete, class: "btn btn-remove small"

- else
  %p.nothing_here_message This team has no projects yet