Added a quick search form in page header. Search functionality moved to a dedicated controller.
When used: * outside of a project: searches projects * inside a project: searches issues, changesets, news, documents and wiki pages of the current project If an issue number is given, user is redirected to the corresponding issue. git-svn-id: http://redmine.rubyforge.org/svn/trunk@489 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -16,14 +16,4 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module ProjectsHelper
|
||||
|
||||
def highlight_tokens(text, tokens)
|
||||
return text unless tokens && !tokens.empty?
|
||||
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'))
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user