comfycamp/lib/comfycamp_web/controllers/user_editor_html.ex

46 lines
989 B
Elixir
Raw Normal View History

2024-08-26 21:05:11 +05:00
defmodule ComfycampWeb.UserEditorHTML do
use ComfycampWeb, :html
def index(assigns) do
~H"""
<div>
<h3>Пользователи</h3>
<table>
<tr>
<th>ID</th>
<th>Email</th>
<th>Одобрен?</th>
<th>Админ?</th>
</tr>
<%= for user <- @users do %>
<tr>
<td><%= user.id %></td>
<td>
<.link href={~p"/admin/users/#{user}"}><%= user.email %></.link>
</td>
<td><%= user.is_approved %></td>
<td><%= user.is_admin %></td>
</tr>
<% end %>
</table>
</div>
"""
end
def show(assigns) do
~H"""
<div>
<h3><%= @user.email %></h3>
<.back navigate={~p"/admin/users"}>Назад</.back>
<p>
<%= if @user.info do %>
<%= @user.info %>
<% else %>
Описания нет.
<% end %>
</p>
</div>
"""
end
end