BigW Consortium Gitlab

_group_member.html.haml 2.42 KB
Newer Older
1
- user = member.user
2
- return unless user || member.invite?
3
- show_roles = true if show_roles.nil?
4

5
%li{class: "#{dom_class(member)} js-toggle-container", id: dom_id(member)}
6
  %span{class: ("list-item-name" if show_controls)}
7 8
    - if member.user
      = image_tag avatar_icon(user.email, 16), class: "avatar s16", alt: ''
9 10
      %strong
        = link_to user.name, user_path(user)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
      %span.cgray= user.username
      - if user == current_user
        %span.label.label-success It's you
      - if user.blocked?
        %label.label.label-danger
          %strong Blocked
    - else
      = image_tag avatar_icon(member.invite_email, 16), class: "avatar s16", alt: ''
      %strong
        = member.invite_email
      %span.cgray
        invited
        - if member.created_by
          by
          = link_to member.created_by.name, user_path(member.created_by)
        = time_ago_with_tooltip(member.created_at)
27

28
      - if show_controls && can?(current_user, :admin_group_member, member)
29 30 31
        = link_to resend_invite_group_group_member_path(@group, member), method: :post, class: "btn-xs btn", title: 'Resend invite' do
          Resend invite

32 33 34 35
  - if show_roles
    %span.pull-right
      %strong= member.human_access
      - if show_controls
36
        - if can?(current_user, :update_group_member, member)
Dmitriy Zaporozhets committed
37
          = button_tag class: "btn-xs btn js-toggle-button",
38
                       title: 'Edit access level', type: 'button' do
39
            %i.fa.fa-pencil-square-o
40
        - if can?(current_user, :destroy_group_member, member)
41
           
42 43
          - if current_user == user
            = link_to leave_group_group_members_path(@group), data: { confirm: leave_group_message(@group.name)}, method: :delete, class: "btn-xs btn btn-remove", title: 'Remove user from group' do
44 45
              = icon("sign-out")
              Leave
46
          - else
47
            = 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
48
              %i.fa.fa-minus.fa-inverse
49

50
    .edit-member.hide.js-toggle-content
51
      %br
52
      = form_for [@group, member], remote: true do |f|
53 54 55
        .prepend-top-10
          = f.select :access_level, options_for_select(GroupMember.access_level_roles, member.access_level), {}, class: 'form-control'
        .prepend-top-10
Dmitriy Zaporozhets committed
56
          = f.submit 'Save', class: 'btn btn-save btn-sm'