summaryrefslogtreecommitdiffstats
path: root/app/views/context_menus/users.html.erb
blob: 3bd4f7d836f55e3500d1cb7da2647527ccc785d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<ul>
  <% if @user %>
    <% if @user.locked? %>
      <li>
        <%= context_menu_link l(:button_unlock), user_path(@user, user: { status: User::STATUS_ACTIVE }, back_url: @back), method: :put, class: 'icon icon-unlock' %>
      </li>
    <% elsif User.current != @user %>
      <li>
        <%= context_menu_link l(:button_lock), user_path(@user, user: { status: User::STATUS_LOCKED }, back_url: @back), method: :put, class: 'icon icon-lock' %>
      </li>
    <% end %>

    <li>
      <%= context_menu_link l(:button_edit), edit_user_path(@user, back_url: @back), class: 'icon icon-edit' %>
    </li>

    <% unless User.current == @user %>
      <li>
        <%= context_menu_link l(:button_delete), user_path(@user, back_url: @back),
          method: :delete, class: 'icon icon-del' %>
      </li>
    <% end %>
  <% else %>
    <li>
      <%= context_menu_link l(:button_delete),
        {controller: 'users', action: 'bulk_destroy', ids: @users.map(&:id)},
        method: :delete, class: 'icon icon-del' %>
    </li>
  <% end %>
</ul>