2012-03-06 15:53:04 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
|
|
|
class SearchController < ApplicationController
|
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
|
2012-11-21 12:09:01 +00:00
|
|
|
@type = params[:type] || 'all'
|
|
|
|
@query = params[:query]
|
2012-11-21 15:04:41 +00:00
|
|
|
Search.by_term_and_type(
|
|
|
|
@query,
|
|
|
|
@type,
|
|
|
|
{:page => params[:page]}
|
|
|
|
).each do |k, v|
|
|
|
|
var = :"@#{k}"
|
|
|
|
instance_variable_set var, v unless instance_variable_defined?(var)
|
2012-03-06 15:53:04 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|