%h3.page_title
  Group: #{@group.name}

  = link_to edit_admin_group_path(@group), class: "btn btn-small pull-right" do
    %i.icon-edit
    Edit
%hr
.row
  .span6
    .ui-box
      %h5.title
        Group info:
      %ul.well-list
        %li
          %span.light Name:
          %strong= @group.name
        %li
          %span.light Path:
          %strong
            = @group.path

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

        %li
          %span.light Owned by:
          %strong
            - if @group.owner
              = link_to @group.owner_name, admin_user_path(@group.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 [:admin, @group] do |f|
              = users_select_tag(:"group[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
            = @group.created_at.stamp("March 1, 1999")


    .ui-box
      %h5.title
        Add user to Group projects:
      .ui-box-body.form-holder
        %p.light
          Read more about project permissions
          %strong= link_to "here", help_permissions_path, class: "vlink"

        = form_tag project_teams_update_admin_group_path(@group), id: "new_team_member", class: "bulk_import", method: :put  do
          %div
            = users_select_tag(:user_ids, multiple: true)
          %div.prepend-top-10
            = select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span2"}
          %hr
          = submit_tag 'Add user to projects in group', class: "btn btn-create"
    .ui-box
      %h5.title
        Users from Group projects
        %small
          (#{@group.users.count})
      %ul.well-list
        - @group.users.sort_by(&:name).each do |user|
          %li{class: dom_class(user)}
            %strong
              = link_to user.name, admin_user_path(user)
            %span.pull-right.light
              = pluralize user.authorized_projects.in_namespace(@group).count, 'project'

  .span6
    .ui-box
      %h5.title
        Projects
        %small
          (#{@group.projects.count})
      %ul.well-list
        - @group.projects.sort_by(&:name).each do |project|
          %li
            %strong
              = link_to project.name_with_namespace, [:admin, project]
            %span.pull-right.light
              %span.monospace= project.path_with_namespace + ".git"
