- page_title "Groups"
%h3.page_title Share project with other groups
%p.light
  Projects can be stored in only one group at once. However you can share a project with other groups here.
%hr
- if @group_links.present?
  .enabled-groups.panel.panel-default
    .panel-heading
      Already shared with
    %ul.well-list
      - @group_links.each do |group_link|
        - group = group_link.group
        %li
          .pull-right
            = link_to namespace_project_group_link_path(@project.namespace, @project, group_link), method: :delete, class: 'btn btn-sm' do
              %i.icon-remove
              disable sharing
          = link_to group do
            %strong
              %i.icon-folder-open
              = group.name
          %br
          .light up to #{group_link.human_access}


.available-groups
  %h4
    Can be shared with
  %div
    = form_tag namespace_project_group_links_path(@project.namespace, @project), method: :post, class: 'form-horizontal' do
      .form-group
        = label_tag :link_group_id, 'Group', class: 'control-label'
        .col-sm-10
          = groups_select_tag(:link_group_id, skip_group: @project.group.try(:path))
      .form-group
        = label_tag :link_group_access, 'Max access level', class: 'control-label'
        .col-sm-10
          = select_tag :link_group_access, options_for_select(ProjectGroupLink.access_options, ProjectGroupLink.default_access), class: "form-control"
      .form-actions
        = submit_tag "Share", class: "btn btn-create"

