Merge branch 'develop_v2' of github.com:sgmap/tps into develop_v2
This commit is contained in:
commit
200a99dbae
1 changed files with 11 additions and 6 deletions
|
@ -35,14 +35,19 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
||||||
def search
|
def search
|
||||||
@search_terms = params[:q]
|
@search_terms = params[:q]
|
||||||
|
|
||||||
@dossier = Search.new(
|
# exact id match?
|
||||||
|
@dossier = Dossier.where(id: @search_terms)
|
||||||
|
|
||||||
|
# full text search
|
||||||
|
unless @dossier.any?
|
||||||
|
@dossier ||= Search.new(
|
||||||
gestionnaire: current_gestionnaire,
|
gestionnaire: current_gestionnaire,
|
||||||
query: @search_terms,
|
query: @search_terms,
|
||||||
page: params[:page]
|
page: params[:page]
|
||||||
).results
|
).results
|
||||||
|
end
|
||||||
|
|
||||||
smartlisting_dossier @dossier, 'search'
|
smartlisting_dossier @dossier, 'search'
|
||||||
|
|
||||||
rescue RuntimeError
|
rescue RuntimeError
|
||||||
smartlisting_dossier [], 'search'
|
smartlisting_dossier [], 'search'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue