Skip to content

Commit

Permalink
Fixing issue where suggestion would show the same suggestion as the t…
Browse files Browse the repository at this point in the history
…erm being searched.
  • Loading branch information
blackjk3 committed Oct 27, 2015
1 parent 60b2a7f commit 49e6dae
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions app/views/studies/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
- unless @suggestions.nil?
- unless @suggestions['suggestions'].empty?
- if @suggestions['suggestions'][0]['options'].size > 0
.suggestions
.alert.alert-info
%i.fa.fa-info-circle
Did you mean
- replacement_search = params[:search][:q].gsub(@suggestions['suggestions'][0]['text'], @suggestions['suggestions'][0]['options'][0]['text'])
"
- url = request.original_url.encode('utf-8', 'ascii-8bit')
%a{ href: url.gsub( params[:search][:q].gsub(' ', '+'), replacement_search.gsub(' ', '+')) }
= replacement_search
" ?
- replacement_search = params[:search][:q].gsub(@suggestions['suggestions'][0]['text'], @suggestions['suggestions'][0]['options'][0]['text'])
- if replacement_search != params[:search][:q]
.suggestions
.alert.alert-info
%i.fa.fa-info-circle
Did you mean
"
- url = request.original_url.encode('utf-8', 'ascii-8bit')
%a{ href: url.gsub( params[:search][:q].gsub(' ', '+'), replacement_search.gsub(' ', '+')) }
= replacement_search
" ?

.study-results
.study-results-info
Expand Down

0 comments on commit 49e6dae

Please sign in to comment.