Add admin user details page

This commit is contained in:
Râu Cao 2023-02-23 22:09:23 +08:00
parent 1a2482434c
commit ffed398024
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
3 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,5 @@
class Admin::UsersController < Admin::BaseController class Admin::UsersController < Admin::BaseController
before_action :set_user, only: [:show]
before_action :set_current_section before_action :set_current_section
def index def index
@ -12,8 +13,16 @@ class Admin::UsersController < Admin::BaseController
} }
end end
def show
end
private private
def set_user
address = params[:address].split("@")
@user = User.where(cn: address.first, ou: address.last).first
end
def set_current_section def set_current_section
@current_section = :users @current_section = :users
end end

View File

@ -0,0 +1,6 @@
<%= render HeaderComponent.new(title: "User: #{@user.address}") %>
<%= render MainSimpleComponent.new do %>
<section>
</section>
<% end %>

View File

@ -39,7 +39,7 @@ Rails.application.routes.draw do
namespace :admin do namespace :admin do
root to: 'dashboard#index' root to: 'dashboard#index'
resources 'users', only: ['index'] resources 'users', param: 'address', only: ['index', 'show'], constraints: { address: /.*/ }
get 'invitations', to: 'invitations#index' get 'invitations', to: 'invitations#index'
resources :donations resources :donations
get 'lightning', to: 'lightning#index' get 'lightning', to: 'lightning#index'