philomena/lib/philomena_web/templates/admin/user/index.html.slime

95 lines
2.7 KiB
Text
Raw Normal View History

2019-12-16 03:21:14 +01:00
h1 Users
2024-06-06 22:28:35 +02:00
= form_for :user, ~p"/admin/users", [method: "get", class: "hform"], fn f ->
2019-12-16 03:21:14 +01:00
.field
=> text_input f, :q, name: "q", class: "hform__text input", placeholder: "Search query"
= submit "Search", class: "button hform__button"
2024-06-06 22:28:35 +02:00
=> link "Site staff", to: ~p"/admin/users?#{[staff: 1]}"
2019-12-16 03:21:14 +01:00
' •
2024-06-06 22:28:35 +02:00
=> link "2FA users", to: ~p"/admin/users?#{[twofactor: 1]}"
2019-12-16 03:21:14 +01:00
2024-06-06 22:28:35 +02:00
- route = fn p -> ~p"/admin/users?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @users, route: route, conn: @conn, params: page_params(@conn.params)
2019-12-16 03:21:14 +01:00
.block
.block__header
= pagination
.block__content
table.table
thead
tr
th Name
th Email
th Activated
th Role
th Created
th Options
tbody
= for user <- @users do
tr
td
2024-06-06 22:28:35 +02:00
= link user.name, to: ~p"/profiles/#{user}"
2019-12-16 03:21:14 +01:00
= cond do
- user.otp_required_for_login ->
2019-12-19 23:45:09 +01:00
span.banner__2fa.success
i.fas.fa-check>
' 2FA
2019-12-16 03:21:14 +01:00
- user.role != "user" and !user.otp_required_for_login ->
2023-11-23 17:07:49 +01:00
span.banner__2fa.danger
2019-12-19 23:45:09 +01:00
i.fas.fa-times>
' 2FA
2019-12-16 03:21:14 +01:00
- true ->
td
= if can?(@conn, :edit, Philomena.Users.User) do
= user.email
- else
i N/A
2019-12-16 03:21:14 +01:00
td
2020-08-18 00:19:49 +02:00
= cond do
- user.deleted_at ->
strong> Deactivated
= pretty_time user.deleted_at
- user.confirmed_at ->
' Active
- true ->
strong> Unconfirmed
2019-12-16 03:21:14 +01:00
td
= String.capitalize(user.role)
td
= pretty_time user.created_at
td
= if can?(@conn, :edit, user) do
2024-06-06 22:28:35 +02:00
=> link to: ~p"/admin/users/#{user}/edit" do
2024-05-20 22:30:41 +02:00
i.fa.icon--padded.small.fa-user-edit
' Edit
2019-12-16 03:21:14 +01:00
/= if user.deleted_at do
/ => link_to 'Reactivate', admin_user_activation_path(user), data: { confirm: t('are_you_sure') }, method: :create
/- else
/ => link_to 'Deactivate', admin_user_activation_path(user), data: { confirm: t('are_you_sure') }, method: :delete
/' &bull;
= if can?(@conn, :index, Philomena.Bans.User) do
2024-06-06 22:28:35 +02:00
=> link to: ~p"/admin/user_bans/new?#{[username: user.name]}" do
2024-05-20 22:30:41 +02:00
i.fa.icon--padded.small.fa-ban
' Ban
= if can?(@conn, :edit, Philomena.ArtistLinks.ArtistLink) do
2024-06-06 22:28:35 +02:00
=> link to: ~p"/profiles/#{user}/artist_links/new" do
2024-05-20 22:30:41 +02:00
i.fa.icon--padded.small.fa-link
' Add link
2019-12-16 03:21:14 +01:00
.block__header.block__header--light
= pagination