_group_member.html.haml 2.38 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
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    - if member.user
      = image_tag avatar_icon(user.email, 16), class: "avatar s16", alt: ''
      %strong= user.name
      %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)
26

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

31
32
33
34
  - if show_roles
    %span.pull-right
      %strong= member.human_access
      - if show_controls
35
        - if can?(current_user, :modify_group_member, member)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
36
          = button_tag class: "btn-xs btn js-toggle-button",
37
                       title: 'Edit access level', type: 'button' do
38
            %i.fa.fa-pencil-square-o
39
        - if can?(current_user, :destroy_group_member, member)
40
           
41
42
          - 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
43
44
              = icon("sign-out")
              Leave
45
          - else
46
            = 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
47
              %i.fa.fa-minus.fa-inverse
48

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