- page_title @group.name, "Groups"
%h3.page-title
  Group: #{@group.name}

  = link_to edit_admin_group_path(@group), class: "btn pull-right" do
    %i.fa.fa-pencil-square-o
    Edit
%hr
.row
  .col-md-6
    .panel.panel-default
      .panel-heading
        Group info:
      %ul.well-list
        %li
          = image_tag group_icon(@group), class: "avatar s60"
        %li
          %span.light Name:
          %strong= @group.name
        %li
          %span.light Path:
          %strong
            = @group.path

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

        %li
          %span.light Created on:
          %strong
            = @group.created_at.to_s(:medium)

    .panel.panel-default
      .panel-heading
        %h3.panel-title
          Projects
          %span.badge
            #{@group.projects.count}
      %ul.well-list
        - @projects.each do |project|
          %li
            %strong
              = link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project]
              %span.label.label-gray
                = repository_size(project)
            %span.pull-right.light
              %span.monospace= project.path_with_namespace + ".git"
      .panel-footer
        = paginate @projects, param_name: 'projects_page', theme: 'gitlab'

  .col-md-6
    - if can?(current_user, :admin_group_member, @group)
      .panel.panel-default
        .panel-heading
          Add user(s) to the group:
        .panel-body.form-holder
          %p.light
            Read more about project permissions
            %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"

          = form_tag members_update_admin_group_path(@group), id: "new_project_member", class: "bulk_import", method: :put  do
            %div
              = users_select_tag(:user_ids, multiple: true, email_user: true, scope: :all)
            %div.prepend-top-10
              = select_tag :access_level, options_for_select(GroupMember.access_level_roles), class: "project-access-select select2"
            %hr
            = button_tag 'Add users to group', class: "btn btn-create"
    .panel.panel-default
      .panel-heading
        %h3.panel-title
          Members
          %span.badge
            #{@group.group_members.count}
      %ul.well-list.group-users-list
        - @members.each do |member|
          - user = member.user
          %li{class: dom_class(member), id: (dom_id(user) if user)}
            .list-item-name
              - if user
                %strong
                  = link_to user.name, admin_user_path(user)
              - else
                %strong
                  = member.invite_email
                (invited)
            %span.pull-right.light
              = member.human_access
              - if can?(current_user, :destroy_group_member, member)
                = link_to group_group_member_path(@group, member), data: { confirm: remove_user_from_group_message(@group, member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do
                  %i.fa.fa-minus.fa-inverse
      .panel-footer
        = paginate @members, param_name: 'members_page', theme: 'gitlab'
