- group_member = local_assigns[:group_member]
- css_class = '' unless local_assigns[:css_class]
- css_class += " no-description" if group.description.blank?

%li.group-row{ class: css_class }
  - if group_member
    .controls.hidden-xs
      - if can?(current_user, :admin_group, group)
        = link_to edit_group_path(group), class: "btn" do
          = icon('cogs')

      = link_to leave_group_group_members_path(group), data: { confirm: leave_confirmation_message(group) }, method: :delete, class: "btn", title: 'Leave this group' do
        = icon('sign-out')

  .stats
    %span
      = icon('bookmark')
      = number_with_delimiter(group.projects.count)

    %span
      = icon('users')
      = number_with_delimiter(group.users.count)

    %span.visibility-icon.has-tooltip{data: { container: 'body', placement: 'left' }, title: visibility_icon_description(group)}
      = visibility_level_icon(group.visibility_level, fw: false)

  = image_tag group_icon(group), class: "avatar s40 hidden-xs"
  .title
    = link_to group, class: 'group-name' do
      = group.name

    - if group_member
      as
      %span #{group_member.human_access}

  - if group.description.present?
    .description
      = markdown(group.description, pipeline: :description)
