%h3.page-title
  Project: #{@project.name_with_namespace}
  = link_to edit_project_path(@project), class: "btn pull-right" do
    %i.icon-edit
    Edit
%hr
.row
  .col-md-6
    .ui-box
      .title
        Project info:
      %ul.well-list
        %li
          %span.light Name:
          %strong
            = link_to @project.name, project_path(@project)
        %li
          %span.light Namespace:
          %strong
            - if @project.namespace
              = link_to @project.namespace.human_name, [:admin, @project.group || @project.owner]
            - else
              Global
        %li
          %span.light Owned by:
          %strong
            - if @project.owner
              = link_to @project.owner_name, [:admin, @project.owner]
            - else
              (deleted)

        %li
          %span.light Created by:
          %strong
            = @project.creator.try(:name) || '(deleted)'

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

        %li
          %span.light http:
          %strong
            = link_to @project.http_url_to_repo
        %li
          %span.light ssh:
          %strong
            = link_to @project.ssh_url_to_repo
        - if @project.repository.exists?
          %li
            %span.light fs:
            %strong
              = @repository.path_to_repo

          %li
            %span.light Size
            %strong
              = repository_size(@project)

          %li
            %span.light last commit:
            %strong
              = last_commit(@project)
        - else
          %li
            %span.light repository:
            %strong.cred
              does not exist

        %li
          %span.light access:
          %strong
            %span{ class: visibility_level_color(@project.visibility_level) }
              = visibility_level_icon(@project.visibility_level)
              = visibility_level_label(@project.visibility_level)

    .ui-box
      .title
        Transfer project
      .body
        = form_for @project, url: transfer_admin_project_path(@project), method: :put, html: { class: 'form-horizontal' } do |f|
          .form-group
            = f.label :namespace_id, "Namespace", class: 'control-label'
            .col-sm-10
              = namespace_select_tag :namespace_id, selected: params[:namespace_id], class: 'input-large'

          .form-group
            .col-sm-2
            .col-sm-10
              = f.submit 'Transfer', class: 'btn btn-primary'

  .col-md-6
    - if @group
      .ui-box
        .title
          %strong #{@group.name}
          group members (#{@group.users_groups.count})
          .pull-right
            = link_to admin_group_path(@group), class: 'btn btn-small' do
              %i.icon-edit
        %ul.well-list
          - @group.users_groups.order('group_access DESC').each do |member|
            = render 'users_groups/users_group', member: member, show_controls: false

    .ui-box
      .title
        Project members
        %small
          (#{@project.users.count})
        .pull-right
          = link_to project_team_index_path(@project), class: "btn btn-tiny" do
            %i.icon-edit
            Manage Access
      %ul.well-list.team_members
        - @project.users_projects.each do |users_project|
          - user = users_project.user
          %li.users_project
            %strong
              = link_to user.name, admin_user_path(user)
            .pull-right
              - if users_project.owner?
                %span.light Owner
              - else
                %span.light= users_project.human_access
                = link_to project_team_member_path(@project, user), data: { confirm: remove_from_project_team_message(@project, user)}, method: :delete, remote: true, class: "btn btn-small btn-remove" do
                  %i.icon-remove
