Class: Kaui::HomeController

Inherits:
EngineController show all
Defined in:
app/controllers/kaui/home_controller.rb

Constant Summary collapse

QUERY_PARSE_REGEX =
['FIND:(?<object_type>.*) BY:(?<search_by>.*) FOR:(?<search_for>.*) ONLY_FIRST:(?<fast>.*)',
'FIND:(?<object_type>.*) BY:(?<search_by>.*) FOR:(?<search_for>.*)',
'FIND:(?<object_type>.*) FOR:(?<search_for>.*) ONLY_FIRST:(?<fast>.*)',
'FIND:(?<object_type>.*) FOR:(?<search_for>.*)']
SIMPLE_PARSE_REGEX =
'(?<search_for>.*)'

Constants included from EngineControllerUtil

EngineControllerUtil::SIMPLE_PAGINATION_THRESHOLD

Instance Method Summary collapse

Methods inherited from EngineController

#check_for_redirect_to_tenant_screen, #current_ability, #current_user, #options_for_klient, #populate_account_details, #retrieve_allowed_users_for_current_user, #retrieve_tenants_for_current_user

Instance Method Details

#indexObject


10
11
12
# File 'app/controllers/kaui/home_controller.rb', line 10

def index
  @search_query = params[:q]
end

#searchObject


14
15
16
17
18
19
20
21
# File 'app/controllers/kaui/home_controller.rb', line 14

def search
  object_type, search_query, search_by, fast = parse_query(params[:q])

  unless object_type.nil?
    cached_options_for_klient = options_for_klient
    send("#{object_type}_search", search_query, search_by, fast, cached_options_for_klient)
  end
end