Simplify admin user editing - remove modal, use regular CRUD pages

Remove complex modal implementation and replace with simple page navigation:
- Convert get_user view from modal partial to full edit page
- Add proper form with Bootstrap 5 styling
- Link directly from users list to edit page
- Update controller actions to redirect instead of returning JSON
- Add flash messages for success/error feedback
- Remove all modal JavaScript and markup
- Remove modal CSS and backdrop handling

Benefits:
- Much simpler and more maintainable
- No JavaScript errors or complexity
- Standard Rails CRUD pattern
- Better user experience with proper navigation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ken Johnson
2025-12-07 22:26:17 +00:00
parent 844acfc8e6
commit decf82962d
3 changed files with 65 additions and 144 deletions
+10 -9
View File
@@ -2,7 +2,7 @@
class AdminController < ApplicationController
before_action :administrative, if: :admin_param, except: [:get_user]
skip_before_action :has_info
layout false, only: [:get_all_users, :get_user]
layout false, only: [:get_all_users]
def dashboard
end
@@ -38,10 +38,11 @@ class AdminController < ApplicationController
pass = params[:user][:password]
user.password = pass if !(pass.blank?)
user.save!
message = true
end
respond_to do |format|
format.json { render json: { msg: message ? "success" : "failure"} }
flash[:success] = "User updated successfully"
redirect_to admin_get_all_users_path(current_user.id)
else
flash[:error] = "User not found"
redirect_to admin_get_all_users_path(current_user.id)
end
end
@@ -51,11 +52,11 @@ class AdminController < ApplicationController
# Call destroy here so that all association records w/ id are destroyed as well
# Example user.retirement records would be destroyed
user.destroy
message = true
end
respond_to do |format|
format.json { render json: { msg: message ? "success" : "failure"} }
flash[:success] = "User deleted successfully"
else
flash[:error] = "Cannot delete this user"
end
redirect_to admin_get_all_users_path(current_user.id)
end
private