_group_member.html.haml 2.51 KB
Newer Older
1
- user = member.user
2
- return unless user || member.invite?
3
- show_roles = local_assigns.fetch(:show_roles, true)
4

5
%li{class: "#{dom_class(member)} js-toggle-container", id: dom_id(member)}
6
  %span{class: ("list-item-name" if show_controls)}
7
    - if member.user
8
      = image_tag avatar_icon(user, 24), class: "avatar s24", alt: ''
9 10
      %strong
        = link_to user.name, user_path(user)
11 12 13 14 15 16 17
      %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
18
      = image_tag avatar_icon(member.invite_email, 24), class: "avatar s24", alt: ''
19 20 21 22 23 24 25 26
      %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, @group)
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
  - if show_roles && should_user_see_group_roles?(current_user, @group)
33
    %span.pull-right
34
      %strong.member-access-level= member.human_access
35
      - if show_controls
36
        - if can?(current_user, :update_group_member, member)
37
          = button_tag class: "btn-xs btn btn-grouped inline js-toggle-button",
38
                       title: 'Edit access level', type: 'button' do
39
            = icon('pencil')
40

41
        - if can?(current_user, :destroy_group_member, member)
42
           
43 44
          - 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
45 46
              = icon("sign-out")
              Leave
47
          - else
48
            = 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
49
              = icon('trash')
50

51
    .edit-member.hide.js-toggle-content
52
      %br
53
      = form_for [@group, member], remote: true do |f|
54 55 56
        .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's avatar
Dmitriy Zaporozhets committed
57
          = f.submit 'Save', class: 'btn btn-save btn-sm'