2012-07-12 00:20:43 +02:00
|
|
|
class SearchController < ApplicationController
|
|
|
|
def index
|
2016-11-15 17:30:30 +01:00
|
|
|
@title = I18n.t 'controllers.search_controller.searchtitle'
|
2012-07-12 00:20:43 +02:00
|
|
|
@cur_url = "/search"
|
|
|
|
|
|
|
|
@search = Search.new
|
|
|
|
|
2013-02-08 17:39:51 +01:00
|
|
|
if params[:q].to_s.present?
|
|
|
|
@search.q = params[:q].to_s
|
2012-07-12 00:20:43 +02:00
|
|
|
|
2015-01-29 17:04:02 +01:00
|
|
|
if params[:what].present?
|
|
|
|
@search.what = params[:what]
|
|
|
|
end
|
|
|
|
if params[:order].present?
|
|
|
|
@search.order = params[:order]
|
|
|
|
end
|
2013-02-08 17:39:51 +01:00
|
|
|
if params[:page].present?
|
2012-07-12 00:20:43 +02:00
|
|
|
@search.page = params[:page].to_i
|
|
|
|
end
|
|
|
|
|
|
|
|
if @search.valid?
|
2017-05-16 19:30:48 +02:00
|
|
|
begin
|
|
|
|
@search.search_for_user!(@user)
|
|
|
|
rescue ThinkingSph::ConnectionError
|
|
|
|
flash[:error] = I18n.t 'controllers.search_controller.flasherrorsearchcontroller'
|
|
|
|
end
|
2012-07-12 00:20:43 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
render :action => "index"
|
|
|
|
end
|
|
|
|
end
|