2012-03-06 15:53:04 +00:00
|
|
|
class SearchController < ApplicationController
|
2014-11-17 21:17:03 +00:00
|
|
|
include PaginateHelper
|
|
|
|
|
2012-03-31 00:37:54 +01:00
|
|
|
before_filter :authenticate_user! unless APP_CONFIG['anonymous_access']
|
2012-03-06 15:53:04 +00:00
|
|
|
# load_and_authorize_resource
|
|
|
|
|
|
|
|
def index
|
2014-11-17 21:17:03 +00:00
|
|
|
@type = Search::TYPES.find{ |t| t == params[:type] } || Search::TYPES.first
|
|
|
|
@query = params[:query]
|
|
|
|
@search = Search.new(@query, current_ability, paginate_params)
|
|
|
|
@collection = @search.send(@type)
|
2012-03-06 15:53:04 +00:00
|
|
|
end
|
|
|
|
end
|