Add Users#show

This commit is contained in:
2023-05-05 18:29:11 +02:00
parent e68092f6b5
commit a7fce807c5
8 changed files with 68 additions and 38 deletions

View File

@@ -1,23 +1,24 @@
<% if current_user.at_least(:admin) %>
<table class="items" id="users">
<table class="items" id="users">
<thead>
<tr>
<th><%= User.human_attribute_name(:email).capitalize %></th>
<th><%= User.human_attribute_name(:status).capitalize %></th>
<th><%= User.human_attribute_name(:created_at).capitalize %> <sup>UTC</sup></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> -->
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<%# TODO: add user show link %>
<td><%= user.email %></td>
<td><%= link_to user.email, user_path(user) %></td>
<td><%= user.status %></td>
<td><%= user.created_at.to_fs(:db_without_sec) %></td>
<td class="svg">
<%= 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> -->
</tr>
<% end %>
</table>
<% end %>
</tbody>
</table>

View File

@@ -1,6 +1,6 @@
<% content_for :navigation, flush: true do %>
<div class="left">
<%= image_link_to t(".back"), "arrow-left-bold-outline",
<%= image_link_to t(:back), "arrow-left-bold-outline",
request.referer.present? ? :back : root_url %>
</div>
<div class="right">
@@ -11,12 +11,6 @@
<% end %>
<%= tabular_form_for resource, url: registration_path(resource), html: {method: :patch} do |f| %>
<%= f.select :status, User.statuses, readonly: !current_user.at_least(:admin) %>
<% if current_user.at_least(:admin) %>
<%= f.text_field :created_at, readonly: true, tabindex: -1 %>
<% end %>
<%= f.email_field :email, size: 30, autofocus: true, autocomplete: "off" %>
<% if f.object.pending_reconfirmation? %>
<%= f.text_field :unconfirmed_email, readonly: true, tabindex: -1,
@@ -24,6 +18,8 @@
timestamp: f.object.confirmation_sent_at.to_fs(:db_without_sec)) %>
<% end %>
<%= f.select :status, User.statuses, readonly: true %>
<%= f.password_field :password, size: 30, autocomplete: "off",
hint: t('.blank_password_hint_html',
subhint: t('.minimum_length_hint_html', count: @minimum_password_length)) %>

View File

@@ -1,10 +1,19 @@
<p style="color: green"><%= notice %></p>
<% content_for :navigation, flush: true do %>
<div class="left">
<%= image_link_to t(:back), "arrow-left-bold-outline", users_path %>
</div>
<% end %>
<%= render @user %>
<%= tabular_form_for @user do |f| %>
<%= f.email_field :email, readonly: true %>
<% if f.object.pending_reconfirmation? %>
<%= f.email_field :unconfirmed_email, readonly: true,
hint: t("users.registrations.edit.unconfirmed_email_hint",
timestamp: f.object.confirmation_sent_at.to_fs(:db_without_sec)) %>
<% end %>
<div>
<%= link_to "Edit this user", edit_user_path(@user) %> |
<%= link_to "Back to users", users_path %>
<%= f.select :status, User.statuses, readonly: true %>
<%= button_to "Destroy this user", @user, method: :delete %>
</div>
<%= f.text_field :created_at, readonly: true %>
<%= f.text_field :confirmed_at, readonly: true %>
<% end %>