BigW Consortium Gitlab

_project_member.html.haml 2.57 KB
Newer Older
1
- user = member.user
2
- return unless user || member.invite?
3 4 5

%li{class: "#{dom_class(member)} js-toggle-container project_member_row access-#{member.human_access.downcase}", id: dom_id(member)}
  %span.list-item-name
6
    - if member.user
7
      = image_tag avatar_icon(user, 24), class: "avatar s24", alt: ''
8 9 10 11 12 13 14 15 16
      %strong
        = link_to user.name, user_path(user)
      %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
17
      = image_tag avatar_icon(member.invite_email, 24), class: "avatar s24", alt: ''
18 19 20 21 22 23 24 25
      %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
      - if can?(current_user, :admin_project_member, @project)
28 29 30
        = link_to resend_invite_namespace_project_project_member_path(@project.namespace, @project, member), method: :post, class: "btn-xs btn", title: 'Resend invite' do
          Resend invite

31 32 33 34
  - if can?(current_user, :admin_project_member, @project)
    .pull-right
      %strong= member.human_access
      - if can?(current_user, :update_project_member, member)
35 36 37 38
        = button_tag class: "btn-xs btn js-toggle-button",
                     title: 'Edit access level', type: 'button' do
          %i.fa.fa-pencil-square-o

39
      - if can?(current_user, :destroy_project_member, member)
40
         
41
        - if current_user == user
42 43 44
          = link_to leave_namespace_project_project_members_path(@project.namespace, @project), data: { confirm: leave_project_message(@project) }, method: :delete, class: "btn-xs btn btn-remove", title: 'Leave project' do
            = icon("sign-out")
            Leave
45
        - else
46
          = link_to namespace_project_project_member_path(@project.namespace, @project, member), data: { confirm: remove_from_project_team_message(@project, member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from team' do
47
            %i.fa.fa-minus.fa-inverse
48

49
    .edit-member.hide.js-toggle-content
50
      %br
51
      = form_for member, as: :project_member, url: namespace_project_project_member_path(@project.namespace, @project, member), remote: true do |f|
52 53 54 55
        .prepend-top-10
          = f.select :access_level, options_for_select(ProjectMember.access_roles, member.access_level), {}, class: 'form-control'
        .prepend-top-10
          = f.submit 'Save', class: 'btn btn-save'