Fixes artefacts in truncated search results (#3622).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2822 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2009-07-18 09:46:20 +00:00
1 parent 36d8f35192
commit bf0ddc2886
2 files changed
+47 -1

No files matched your search

+2 -1
View File
@@ -27,8 +27,9 @@ module SearchHelper
result << '...'
break
end
words = words.mb_chars
if i.even?
result << h(words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words)
result << h(words.length > 100 ? "#{words.slice(0..44)} ... #{words.slice(-45..-1)}" : words)
else
t = (tokens.index(words.downcase) || 0) % 4
result << content_tag('span', h(words), :class => "highlight token-#{t}")