noesya/osuny

View on GitHub
app/views/admin/users/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, @user %>

<%= render 'lock' %>

<div class="row">
  <div class="col-md-6">
    <h2 class="h5"><%= t('admin.infos') %></h2>
    <div class="table-responsive">
      <table class="<%= table_classes %>">
        <tr>
          <td><%= User.human_attribute_name('email') %></td>
          <td class="text-end"><%= link_to @user.email, "mailto:#{@user.email}" %></td>
        </tr>
        <% ['first_name', 'last_name', 'mobile_phone'].each do |attribute| %>
          <tr>
            <td><%= User.human_attribute_name(attribute) %></td>
            <td class="text-end"><%= @user.public_send attribute %></td>
          </tr>
        <% end %>
        <tr>
          <td><%= User.human_attribute_name('role') %></td>
          <td class="text-end"><%= t("activerecord.attributes.user.roles.#{@user.role.to_s}") %></td>
        </tr>
        <tr>
          <td><%= User.human_attribute_name('language') %></td>
          <td class="text-end"><%= t("languages.#{@user.language.iso_code.to_s}") %></td>
        </tr>
        <% if @user.person %>
          <tr>
            <td><%= User.human_attribute_name('person') %></td>
            <td class="text-end"><%= osuny_link_localized @user.person, [:admin, @user.person] %></td>
          </tr>
        <% end %>
        <% if @user.current_sign_in_at.present? %>
          <tr>
            <td><%= User.human_attribute_name('current_sign_in_at') %></td>
            <td class="text-end"><%= l(@user.current_sign_in_at, format: :date_with_explicit_month) %></td>
          </tr>
        <% end %>
      </table>
    </div>
  </div>
  <% if @user.picture.attached? %>
    <div class="col-md-3">
      <h2 class="h5"><%= t('activerecord.attributes.user.picture') %></h2>
      <%= kamifusen_tag @user.picture, class: 'img-fluid' %>
    </div>
  <% end %>
</div>

<% content_for :action_bar_left do %>
  <%= destroy_link @user %>
<% end %>

<% content_for :action_bar_right do %>
  <%= edit_link @user %>
<% end %>