.row
  .span3
    %ul.nav.nav-pills.nav-stacked
      %li.active
        = link_to 'Projects', '#tab-projects', 'data-toggle' => 'tab'
      %li
        = link_to 'Edit Group', '#tab-edit', 'data-toggle' => 'tab'
      %li
        = link_to 'Transfer', '#tab-transfer', 'data-toggle' => 'tab'
      %li
        = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab'

  .span9
    .tab-content
      .tab-pane.active#tab-projects
        .ui-box
          %h5.title Projects
          %ul.well-list
            - @group.projects.each do |project|
              %li
                - if project.public
                  = public_icon
                - else
                  = private_icon
                = link_to project.name_with_namespace, project
                .pull-right
                  = link_to 'Team', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
                  = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
                  = link_to 'Remove', project, confirm: remove_project_message(project), method: :delete, class: "btn btn-small btn-remove"
            - if @group.projects.blank?
              %p.nothing_here_message This group has no projects yet

      .tab-pane#tab-edit
        .ui-box
          %h5.title Edit Group
          %div.form-holder
            = form_for @group do |f|
              - if @group.errors.any?
                .alert.alert-error
                  %span= @group.errors.full_messages.first
              .clearfix
                = f.label :name do
                  Group name is
                .input
                  = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left"

              .clearfix.group-description-holder
                = f.label :description, "Details"
                .input
                  = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4

              .form-actions
                = f.submit 'Save group', class: "btn btn-save"

      .tab-pane#tab-transfer
        .ui-box.ui-box-danger
          %h5.title Transfer group
          .ui-box-body
            %p
              Transferring group will cause loss of admin control over group and all child projects
            = form_for @group do |f|
              = users_select_tag(:'group[owner_id]')
              %hr
              = f.submit 'Transfer group', class: "btn btn-small btn-remove"

      .tab-pane#tab-remove
        .ui-box.ui-box-danger
          %h5.title Remove group
          .ui-box-body
            %p
              Remove of group will cause removing all child projects and resources.
            %p
              %strong Removed group can not be restored!

            = link_to 'Remove Group', @group, confirm: 'Removed group can not be restored! Are you sure?', method: :delete, class: "btn btn-remove btn-small"
