Class: UsersController
  
  
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #add_breadcrumb, #after_sign_in_path_for, #breadcrumbs, #new_session_path, #render_not_found, #require_admin_user
  
  
    Instance Method Details
    
      
  
  
    #edit  ⇒ Object 
  
  
  
  
    
      
15
16
17
18 
     | 
    
      # File 'app/controllers/users_controller.rb', line 15
def edit
  add_breadcrumb("Edit User")
  @user = User.find(params[:id])
end
     | 
  
 
    
      
  
  
    #index  ⇒ Object 
  
  
  
  
    
      
6
7
8 
     | 
    
      # File 'app/controllers/users_controller.rb', line 6
def index
  @users = User.order("uid ASC NULLS LAST").page params[:page]
end
     | 
  
 
    
      
  
  
    #lookup  ⇒ Object 
  
  
  
  
    
      
31
32
33
34
35
36
37
38 
     | 
    
      # File 'app/controllers/users_controller.rb', line 31
def lookup
  query = (params["query"] || "").strip.downcase
  matches = PrincetonUsers.user_list_query(query)
  result = {
    suggestions: matches.take(30).map { |match| { "value": match[:display_name] || "", "data": match[:uid] } }
  }
  render json: result
end
     | 
  
 
    
      
  
  
    #show  ⇒ Object 
  
  
  
  
    
      
10
11
12
13 
     | 
    
      # File 'app/controllers/users_controller.rb', line 10
def show
  add_breadcrumb("User")
  @user = User.find(params[:id])
end
     | 
  
 
    
      
  
  
    #update  ⇒ Object 
  
  
  
  
    
      
20
21
22
23
24
25
26
27
28
29 
     | 
    
      # File 'app/controllers/users_controller.rb', line 20
def update
  update_user_with_params
  redirect_to user_path(@user)
rescue => ex
  short_message = "Error saving user #{params[:id]}"
  Rails.logger.error "#{short_message}: #{ex.message}"
  Honeybadger.notify "#{short_message}: #{ex.message}"
  flash[:alert] = short_message
  redirect_to user_path(id: params[:id])
end
     |