Issue notes are now included in search.

Fixed: search results too long when there are many matches.
Fixed: search results not escaped.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@705 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2007-09-05 19:37:13 +00:00
1 parent c27106d859
commit 8dcc041244
2 files changed
+10 -1

No files matched your search

+6 -1
View File
@@ -21,7 +21,12 @@ module SearchHelper
regexp = Regexp.new "(#{tokens.join('|')})", Regexp::IGNORECASE
result = ''
text.split(regexp).each_with_index do |words, i|
result << (i.even? ? (words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) : content_tag('span', words, :class => 'highlight'))
if result.length > 1200
# maximum length of the preview reached
result << '...'
break
end
result << (i.even? ? h(words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) : content_tag('span', h(words), :class => 'highlight'))
end
result
end