2012-03-06 15:53:04 +00:00
|
|
|
class SearchController < ApplicationController
|
2014-11-17 21:17:03 +00:00
|
|
|
include PaginateHelper
|
|
|
|
|
2015-03-04 23:19:19 +00:00
|
|
|
before_action :authenticate_user! unless APP_CONFIG['anonymous_access']
|
2015-04-07 20:43:40 +01:00
|
|
|
skip_after_action :verify_authorized
|
2012-03-06 15:53:04 +00:00
|
|
|
|
|
|
|
def index
|
2014-11-17 21:17:03 +00:00
|
|
|
@type = Search::TYPES.find{ |t| t == params[:type] } || Search::TYPES.first
|
|
|
|
@query = params[:query]
|
2015-04-06 23:56:06 +01:00
|
|
|
@search = Search.new(@query, current_user, paginate_params)
|
2014-11-17 21:17:03 +00:00
|
|
|
@collection = @search.send(@type)
|
2012-03-06 15:53:04 +00:00
|
|
|
end
|
|
|
|
end
|