UX: move search to its own route

previously search was bundled with discovery, something that makes stuff confusing internally
This commit is contained in:
Sam
2015-07-27 16:13:11 +10:00
parent 68a262ff08
commit 41ceff8430
13 changed files with 244 additions and 63 deletions

View File

@@ -2,10 +2,30 @@ require_dependency 'search'
class SearchController < ApplicationController
skip_before_filter :check_xhr, only: :show
def self.valid_context_types
%w{user topic category private_messages}
end
def show
search = Search.new(params[:q], type_filter: 'topic', guardian: guardian, include_blurbs: true, blurb_length: 300)
result = search.execute
serializer = serialize_data(result, GroupedSearchResultSerializer, :result => result)
respond_to do |format|
format.html do
store_preloaded("search", MultiJson.dump(serializer))
end
format.json do
render_json_dump(serializer)
end
end
end
def query
params.require(:term)