<% content_for :title, @user.username %>

<%= @user.username %>

<% if @user.admin? %> 管理者 <% end %>
<%= link_to "編集", edit_user_path(@user), class: "inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" %> <%= link_to "一覧に戻る", users_path, class: "inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" %>

ユーザー情報

ユーザー名
<%= @user.username %>
メールアドレス
<%= @user.email %>
権限
<%= @user.admin? ? "管理者" : "一般ユーザー" %>
登録日
<%= @user.created_at.strftime("%Y年%m月%d日 %H:%M") %>
最終更新日
<%= @user.updated_at.strftime("%Y年%m月%d日 %H:%M") %>
<% if @user != current_user %>
<%= button_to "#{@user.admin? ? '管理者権限を削除' : '管理者権限を付与'}", toggle_admin_user_path(@user), method: :patch, class: "inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-yellow-600 hover:bg-yellow-700", data: { confirm: "#{@user.admin? ? '管理者権限を削除' : '管理者権限を付与'}しますか?" } %> <%= button_to "ユーザーを削除", user_path(@user), method: :delete, class: "inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700", data: { confirm: "#{@user.username}を削除しますか?" } %>
<% end %>