diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 5bcb52f..7ff4439 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -32,13 +32,17 @@ body { margin: 0 0.5rem; } -input { +/* blue - target for interaction with pointer */ +/* gray - target for interaction with keyboard */ +input, +select { background-color: white; border: 1px solid; border-radius: 0.2rem; border-color: #cccccc; } -input:not([type=checkbox]) { +input:not([type=checkbox]), +select { font-size: 0.9rem; padding: 0.2rem 0.4rem; } @@ -51,8 +55,17 @@ input[type=checkbox] { width: 1.1rem; -webkit-appearance: none; } +input:hover, +select:hover { + border-color: #009ade; + outline: #009ade solid 1px; +} +select:hover { + cursor: pointer; +} input:focus-visible, -input:hover { +select:focus-within, +select:focus-visible { accent-color: #006c9b; background-color: #f3f3f3; } @@ -313,7 +326,12 @@ table.items button { margin-right: 0.25rem; padding: 0.25rem; } +table.items select:not(:hover), table.items button:not(:hover) { border-color: #dddddd; color: #909090; } +table.items select:focus-within, +table.items select:focus-visible { + color: black; +} diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c026731..b1deef4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,7 +1,7 @@ class UsersController < ApplicationController helper_method :allow_disguise? - before_action :find_user, only: [:show, :disguise] + before_action :find_user, only: [:show, :update, :disguise] before_action except: :revert do raise AccessForbidden unless current_user.at_least(:admin) end @@ -16,8 +16,12 @@ class UsersController < ApplicationController def show end + def update + @user.update!(params.require(:user).permit(:status)) + end + def disguise - raise ActionController::BadRequest unless allow_disguise?(@user) + raise ArgumentError unless allow_disguise?(@user) session[:revert_to_id] = current_user.id bypass_sign_in(@user) redirect_to root_url @@ -29,8 +33,6 @@ class UsersController < ApplicationController redirect_to users_url end - # TODO: add #update to change user status - # NOTE: limited actions availabe to :admin by design. Users are meant to # manage their accounts by themselves through registrations. In future :admin # may be allowed to sing-in as user and make changes there. diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 9b3e093..1445f9d 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -12,16 +12,24 @@ <% @users.each do |user| %>