summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-15 16:15:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-15 16:15:20 +0000
commit74ecb37be657611fdc239d808d96f6932d61d3d0 (patch)
tree1595481f7c87ea2cf2a76accc3ad8702d677621b /app/helpers
parent7d54215ccbbbaa356a5207b2dc8841e9d8221d18 (diff)
downloadredmine-74ecb37be657611fdc239d808d96f6932d61d3d0.tar.gz
redmine-74ecb37be657611fdc239d808d96f6932d61d3d0.zip
Search engine:
* results are now displayed using different colors for tokens highlighting * added label tag around "all words" checkbox git-svn-id: http://redmine.rubyforge.org/svn/trunk@841 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/search_helper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 75412c70a..ed2f40b69 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -26,7 +26,12 @@ module SearchHelper
result << '...'
break
end
- result << (i.even? ? h(words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) : content_tag('span', h(words), :class => 'highlight'))
+ if i.even?
+ result << h(words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words)
+ else
+ t = (tokens.index(words.downcase) || 0) % 4
+ result << content_tag('span', h(words), :class => "highlight token-#{t}")
+ end
end
result
end