From 6f256f5f2d752f93c8c3388000065108c6dd69db Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Mon, 8 Dec 2025 22:53:11 -0600 Subject: [PATCH] Show admin toggle, but disable for current user You shouldn't be able to demote yourself but displaying the disabled toggle helps explain the group of admins at the top of the list. Builds upon #140 --- app/assets/stylesheets/buttons.css | 7 +++++++ app/views/accounts/users/_user.html.erb | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/buttons.css b/app/assets/stylesheets/buttons.css index b58c243..8b903c7 100644 --- a/app/assets/stylesheets/buttons.css +++ b/app/assets/stylesheets/buttons.css @@ -127,6 +127,13 @@ } } + &:has(input[type=checkbox][disabled]) { + cursor: not-allowed; + filter: grayscale(100%) contrast(0.5); + opacity: 0.5; + pointer-events: none; + } + [disabled] &[type=submit], &[type=submit]:disabled { cursor: not-allowed; diff --git a/app/views/accounts/users/_user.html.erb b/app/views/accounts/users/_user.html.erb index 470e7f8..dfabcef 100644 --- a/app/views/accounts/users/_user.html.erb +++ b/app/views/accounts/users/_user.html.erb @@ -9,13 +9,13 @@ - <% if Current.user.can_administer? && user != Current.user && user.active? %> + <% if Current.user.can_administer? && user.active? %> <% unless user.bot? %> <%= form_with model: user, url: account_user_path(user), data: { controller: "form" }, method: :patch do | form | %> <% end %> <% end %>