comparison app/helpers/search_helper.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbb26bc654de
children 622f24f53b42
comparison
equal deleted inserted replaced
929:5f33065ddc4b 1115:433d4f72a19b
1 # encoding: utf-8 1 # encoding: utf-8
2 # 2 #
3 # Redmine - project management software 3 # Redmine - project management software
4 # Copyright (C) 2006-2011 Jean-Philippe Lang 4 # Copyright (C) 2006-2012 Jean-Philippe Lang
5 # 5 #
6 # This program is free software; you can redistribute it and/or 6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License 7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2 8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version. 9 # of the License, or (at your option) any later version.
35 else 35 else
36 t = (tokens.index(words.downcase) || 0) % 4 36 t = (tokens.index(words.downcase) || 0) % 4
37 result << content_tag('span', h(words), :class => "highlight token-#{t}") 37 result << content_tag('span', h(words), :class => "highlight token-#{t}")
38 end 38 end
39 end 39 end
40 result 40 result.html_safe
41 end 41 end
42 42
43 def type_label(t) 43 def type_label(t)
44 l("label_#{t.singularize}_plural", :default => t.to_s.humanize) 44 l("label_#{t.singularize}_plural", :default => t.to_s.humanize)
45 end 45 end
61 next if c == 0 61 next if c == 0
62 text = "#{type_label(t)} (#{c})" 62 text = "#{type_label(t)} (#{c})"
63 links << link_to(h(text), :q => params[:q], :titles_only => params[:titles_only], 63 links << link_to(h(text), :q => params[:q], :titles_only => params[:titles_only],
64 :all_words => params[:all_words], :scope => params[:scope], t => 1) 64 :all_words => params[:all_words], :scope => params[:scope], t => 1)
65 end 65 end
66 ('<ul>' + links.map {|link| content_tag('li', link)}.join(' ') + '</ul>') unless links.empty? 66 ('<ul>'.html_safe +
67 links.map {|link| content_tag('li', link)}.join(' ').html_safe +
68 '</ul>'.html_safe) unless links.empty?
67 end 69 end
68 end 70 end