Add Users#disguise/#revert

This commit is contained in:
2023-05-13 23:38:07 +02:00
parent a7fce807c5
commit 459836ca38
8 changed files with 59 additions and 11 deletions

View File

@@ -13,10 +13,15 @@
<body>
<div class="app-menu">
<% if user_signed_in? %>
<%= image_link_to t(:sign_out), "logout", destroy_user_session_path,
data: { turbo: true, turbo_method: :delete } %>
<%= image_link_to t(:profile), "account-wrench-outline", edit_user_registration_path,
current: :hide %>
<% if current_user_disguised? %>
<%= image_link_to t(:revert), "incognito-off", revert_users_path,
data: {turbo: true, turbo_method: :post} %>
<% else %>
<%= image_link_to t(:sign_out), "logout", destroy_user_session_path,
data: {turbo: true, turbo_method: :delete} %>
<% end %>
<%= image_link_to current_user.email, "account-wrench-outline",
edit_user_registration_path, current: :hide %>
<% else %>
<%= image_link_to t(:register), "account-plus-outline", new_user_registration_path,
current: :hide %>

View File

@@ -5,7 +5,7 @@
<th><%= User.human_attribute_name(:status).capitalize %></th>
<th><%= User.human_attribute_name(:confirmed_at).capitalize %></th>
<th><%= User.human_attribute_name(:created_at).capitalize %> <sup>UTC</sup></th>
<!-- <th><%#= t :actions %></th> -->
<th><%= t :actions %></th>
</tr>
</thead>
<tbody>
@@ -17,7 +17,10 @@
<%= svg_tag "pictograms/checkbox-marked-outline" if user.confirmed_at.present? %>
</td>
<td><%= user.created_at.to_fs(:db_without_sec) %></td>
<!-- <td class="actions"></td> -->
<td class="actions">
<%= image_link_to t(".disguise"), "incognito", disguise_user_path(user),
data: {turbo: true, turbo_method: :post} if allow_disguise?(user) %>
</td>
</tr>
<% end %>
</tbody>