<% content_for :title, "ユーザー管理" %>

ユーザー管理

登録されているユーザーの一覧と管理

<% @users.each do |user| %> <% end %>
ユーザー名 メールアドレス 権限 登録日 操作
<%= user.username %>
<%= user.email %>
<% if user.admin? %> 管理者 <% else %> 一般ユーザー <% end %> <%= user.created_at.strftime("%Y年%m月%d日") %> <%= link_to "詳細", user_path(user), class: "text-indigo-600 hover:text-indigo-900" %> <%= link_to "編集", edit_user_path(user), class: "text-blue-600 hover:text-blue-900" %> <% if user != current_user %> <%= button_to "#{user.admin? ? '管理者解除' : '管理者に昇格'}", toggle_admin_user_path(user), method: :patch, class: "inline text-yellow-600 hover:text-yellow-900", data: { confirm: "#{user.admin? ? '管理者権限を削除' : '管理者権限を付与'}しますか?" } %> <%= button_to "削除", user_path(user), method: :delete, class: "inline text-red-600 hover:text-red-900", data: { confirm: "#{user.username}を削除しますか?" } %> <% end %>

合計: <%= @users.count %>ユーザー