summaryrefslogtreecommitdiff
path: root/app/views/shared/members/_group.html.haml
blob: 2aac3a94c49f6068e237cb29e7fe6ea0cb4c29d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
- group_link = local_assigns[:group_link]
- group = group_link.shared_with_group
- can_admin_member = local_assigns[:can_admin_member]
- group_link_path = local_assigns[:group_link_path]
- dom_id = "group_member_#{group_link.id}"

-# Note this is just for groups. For individual members please see shared/members/_member

%li.member.js-member.group_member.py-2.px-3.d-flex.flex-column.flex-md-row{ id: dom_id, data: { qa_selector: 'group_row' } }
  %span.list-item-name.mb-2.m-md-0
    = group_icon(group, class: "avatar s40 flex-shrink-0 flex-grow-0", alt: '')
    .user-info
      = link_to group.full_name, group_path(group), class: 'member'
      .cgray
        Given access #{time_ago_with_tooltip(group_link.created_at)}
        %span.js-expires-in{ class: ('gl-display-none' unless group_link.expires?) }
          ·
          %span.js-expires-in-text{ class: ('text-warning' if group_link.expires_soon?) }
            - if group_link.expires?
              = _("Expires in %{expires_at}").html_safe % { expires_at: distance_of_time_in_words_to_now(group_link.expires_at) }
  .controls.member-controls.align-items-center
    = form_tag group_link_path, method: :put, remote: true, class: 'js-edit-member-form form-group d-sm-flex' do
      = hidden_field_tag "group_link[group_access]", group_link.group_access
      .member-form-control.dropdown.mr-sm-2.d-sm-inline-block
        %button.dropdown-menu-toggle.js-member-permissions-dropdown{ type: "button",
          disabled: !can_admin_member,
          data: { toggle: "dropdown", field_name: "group_link[group_access]" } }
          %span.dropdown-toggle-text
            = group_link.human_access
          = sprite_icon("chevron-down", css_class: "dropdown-menu-toggle-icon gl-top-3")
        .dropdown-menu.dropdown-select.dropdown-menu-right.dropdown-menu-selectable
          = dropdown_title(_("Change role"))
          .dropdown-content
            %ul
              - Gitlab::Access.options_with_owner.each do |role, role_id|
                %li
                  = link_to role, '#',
                    class: ("is-active" if group_link.group_access == role_id),
                    data: { id: role_id, el_id: dom_id }
      .clearable-input.member-form-control.d-sm-inline-block
        = text_field_tag 'group_link[expires_at]', group_link.expires_at, class: 'form-control js-access-expiration-date js-member-update-control', placeholder: _('Expiration date'), id: "member_expires_at_#{group.id}", disabled: !can_admin_member
        = sprite_icon('close', size: 16, css_class: 'clear-icon js-clear-input gl-text-gray-200')
    - if can_admin_member
      = link_to group_link_path,
        method: :delete,
        data: { confirm: _("Are you sure you want to remove %{group_name}?") % { group_name: group.name }, qa_selector: 'delete_group_access_link' },
        class: 'gl-button btn btn-danger m-0 ml-sm-2 align-self-center' do
        %span.d-block.d-sm-none
          = _("Delete")
        = sprite_icon('remove', css_class: 'd-none d-sm-block')