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>
|
2024-08-28 00:58:20 +05:00
|
|
|
|
|
|
|
|
|
<%= if @user.is_approved == false do %>
|
|
|
|
|
<.link
|
|
|
|
|
method="PUT"
|
|
|
|
|
href={~p"/admin/users/#{@user}/approve"}
|
|
|
|
|
data-confirm="Точно хотите одобрить пользователя?"
|
|
|
|
|
>
|
|
|
|
|
Одобрить
|
|
|
|
|
</.link>
|
|
|
|
|
<% else %>
|
|
|
|
|
<.link
|
|
|
|
|
method="PUT"
|
|
|
|
|
href={~p"/admin/users/#{@user}/disapprove"}
|
|
|
|
|
data-confirm="Точно хотите отменить одобрение?"
|
|
|
|
|
>
|
|
|
|
|
Отменить одобрение
|
|
|
|
|
</.link>
|
|
|
|
|
<% end %>
|
2024-08-26 21:05:11 +05:00
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
end
|
|
|
|
|
end
|