%h3.page_title
  Team: #{@team.name}


  = link_to edit_admin_team_path(@team), class: "btn btn-small pull-right" do
    %i.icon-edit
    Edit
%hr


.row
  .span6
    .ui-box
      %h5.title
        Team info:
      %ul.well-list
        %li
          %span.light Name:
          %strong= @team.name
        %li
          %span.light Path:
          %strong
            = @team.path

        %li
          %span.light Description:
          %strong
            = @team.description

        %li
          %span.light Owned by:
          %strong
            - if @team.owner
              = link_to @team.owner.name, admin_user_path(@team.owner)
            - else
              (deleted)
          .pull-right
            = link_to "#", class: "btn btn-small change-owner-link" do
              %i.icon-edit
              Change owner
        %li.change-owner-holder.hide.bgred
          .form-holder
            %strong.cred New Owner:
            = form_for @team, url: admin_team_path(@team) do |f|
              = users_select_tag(:"user_team[owner_id]")
              .prepend-top-10
                = f.submit 'Change Owner', class: "btn btn-remove"
                = link_to "Cancel", "#", class: "btn change-owner-cancel-link"

        %li
          %span.light Created at:
          %strong
            = @team.created_at.stamp("March 1, 1999")

  .span6
    .ui-box
      %h5.title
        Members (#{@team.members.count})
        .pull-right
          = link_to 'Add members', new_admin_team_member_path(@team), class: "btn btn-small", id: :add_members_to_team
      %ul.well-list#members_list
        - @team.members.each do |member|
          %li.member{ class: "user_#{member.id}"}
            = link_to [:admin, member] do
              %strong
                = member.name
            .pull-right
              %span.light
                = @team.human_default_projects_access(member)
              - if @team.admin?(member)
                %span.label.label-info Admin
              &nbsp;
              = link_to 'Edit', edit_admin_team_member_path(@team, member), class: "btn btn-small"
              &nbsp;
              = link_to 'Remove', admin_team_member_path(@team, member), confirm: 'Remove member from team. Are you sure?', method: :delete, class: "btn btn-remove btn-small", id: "remove_member_#{member.id}"


    .ui-box
      %h5.title
        Projects (#{@team.projects.count})
        .pull-right
          = link_to 'Add projects', new_admin_team_project_path(@team), class: "btn btn-small", id: :assign_projects_to_team
      %ul.well-list#projects_list
        - @team.projects.each do |project|
          %li.project
            = link_to [:admin, project] do
              %strong
                = project.name_with_namespace

            .pull-right
              %span.light
                = @team.human_max_project_access(project)
              &nbsp;
              = link_to 'Edit', edit_admin_team_project_path(@team, project), class: "btn btn-small"
              &nbsp;
              = link_to 'Relegate', admin_team_project_path(@team, project), confirm: 'Remove project from team. Are you sure?', method: :delete, class: "btn btn-remove small", id: "relegate_project_#{project.id}"
