Class: WcmsComponents::PeopleController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/wcms_components/people_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/wcms_components/people_controller.rb', line 6

def index
  if can_search_people?
    if params[:q].present?
      @people = permitted_people.custom_search(params[:q]).asc(:first_name, :last_name).limit(10)
    else
      # If no query string is present, return all faculty for pre-cached data.
      @people = []
    end

    render json: @people.map{|p| {id: p.id.to_s, name: p.name, email: p.biola_email, affiliations: p.affiliations.to_a.join(', '), image: p.profile_photo_url} }.to_json
  else
    user_not_authorized
  end
end