From 1b00d26a08f92477aa239b285f838335d19083fa Mon Sep 17 00:00:00 2001 From: icyleaf Date: Fri, 18 Oct 2024 04:29:34 +0000 Subject: [PATCH] refactor: remove delete user action in list page (can operate in detail page) --- app/views/admin/users/_user.html.slim | 15 ++++----------- app/views/admin/users/index.html.slim | 11 +++++------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/app/views/admin/users/_user.html.slim b/app/views/admin/users/_user.html.slim index c312be46..cd0dcb6d 100644 --- a/app/views/admin/users/_user.html.slim +++ b/app/views/admin/users/_user.html.slim @@ -1,26 +1,19 @@ = turbo_frame_tag user, class: 'p-2 ps-3 border-top d-flex' do - .col-3.col-md-2.my-auto + .col-3.col-md-3.my-auto = link_to user.username, edit_admin_user_path(user), data: { turbo_frame: :modal } - .col-7.col-md-3.my-auto + .col-7.col-md-4.my-auto = user.email .col-3.col-md-2.my-auto = user.role_name - .col-2.my-auto.d-none.d-sm-table-cell + .col-2.col-md-1.my-auto.d-none.d-sm-table-cell - if user.access_locked? span.badge.text-bg-danger = t('admin.users.index.locked') - elsif user.confirmed_at span.badge.text-bg-secondary = t('admin.users.index.activated') - else span.badge.text-bg-primary = t('admin.users.index.inactive') - .col-2.my-auto.d-none.d-sm-table-cell + .col-2.col-md-2.my-auto.d-none.d-sm-table-cell - if user.last_sign_in_at = time_ago_in_words(user.last_sign_in_at) - else = t('admin.users.index.never_logged_in') - .col-1.my-auto.d-none.d-sm-table-cell - - if default_admin_in_demo_mode?(current_user) - button.btn.text-danger.p-0.float-end - i.fas.fa-trash-alt - - else - = button_link_to '', admin_user_path(user), 'trash-alt', class: 'btn text-danger p-0 me-3 float-end', \ - data: { turbo_method: :delete, turbo_confirm: t('admin.users.index.destroy_user_confirm', user: user.username) } diff --git a/app/views/admin/users/index.html.slim b/app/views/admin/users/index.html.slim index 3ab350c0..2d9dd58f 100644 --- a/app/views/admin/users/index.html.slim +++ b/app/views/admin/users/index.html.slim @@ -14,17 +14,16 @@ .card .card-body.p-0 .p-2.ps-3.d-flex.fw-bolder.border-bottom.border-1 - .col-sm-4.col-md-2.my-auto + .col-3.col-md-3.my-auto = t('.nickname') - .col-sm-4.col-md-3.my-auto + .col-7.col-md-4.my-auto = t('.email') - .col-sm-4.col-md-2.my-auto + .col-3.col-md-2.my-auto = t('.role') - .col-sm-2.my-auto.d-none.d-sm-table-cell + .col-2.col-md-1.my-auto.d-none.d-sm-table-cell = t('.status') - .col-2.my-auto.d-none.d-sm-table-cell + .col-2.col-md-2.my-auto.d-none.d-sm-table-cell = t('.last_login_time') - .col-1.my-auto.d-none.d-sm-table-cell #users - @users.each_with_index do |user, i| = render user