_user.html.haml 2.44 KB
Newer Older
Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
1
%li.flex-row
2
  .user-avatar
3
    = image_tag avatar_icon_for_user(user), class: "avatar", alt: ''
Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
4 5
  .row-main-content
    .user-name.row-title.str-truncated-100
6 7 8 9 10 11 12 13 14
      = link_to user.name, [:admin, user]
    - if user.blocked?
      %span.label.label-danger blocked
    - if user.admin?
      %span.label.label-success Admin
    - if user.external?
      %span.label.label-default External
    - if user == current_user
      %span It's you!
Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
15
    .row-second-line.str-truncated-100
16
      = mail_to user.email, user.email
17
  .controls
18 19 20
    = link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: 'btn'
    - unless user == current_user
      .dropdown.inline
21
        %a.dropdown-new.btn.btn-default#project-settings-button{ href: '#', data: { toggle: 'dropdown' } }
22 23 24 25 26 27 28 29 30 31 32 33 34 35
          = icon('cog')
          = icon('caret-down')
        %ul.dropdown-menu.dropdown-menu-align-right
          %li.dropdown-header
            Settings
            %li
              - if user.ldap_blocked?
                %span.small Cannot unblock LDAP blocked users
              - elsif user.blocked?
                = link_to 'Unblock', unblock_admin_user_path(user), method: :put
              - else
                = link_to 'Block', block_admin_user_path(user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put
            - if user.access_locked?
              %li
36
                = link_to _('Unlock'), unlock_admin_user_path(user), method: :put, data: { confirm: _('Are you sure?') }
37
          - if can?(current_user, :destroy_user, user)
38
            %li.divider
39 40
            - if user.can_be_removed?
              %li
41 42 43 44 45
                %button.delete-user-button.btn.text-danger{ data: { toggle: 'modal',
                  target: '#delete-user-modal',
                  delete_user_url: admin_user_path(user),
                  block_user_url: block_admin_user_path(user),
                  username: user.name,
46
                  delete_contributions: false }, type: 'button' }
47 48
                  = s_('AdminUsers|Delete user')

49
            %li
50 51 52 53 54
              %button.delete-user-button.btn.text-danger{ data: { toggle: 'modal',
                target: '#delete-user-modal',
                delete_user_url: admin_user_path(user, hard_delete: true),
                block_user_url: block_admin_user_path(user),
                username: user.name,
55
                delete_contributions: true }, type: 'button' }
56
                = s_('AdminUsers|Delete user and contributions')