@@ -5,12 +5,12 | |||||
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 |
# |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 |
# |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
@@ -37,11 +37,11 module SearchHelper | |||||
37 | end |
|
37 | end | |
38 | result |
|
38 | result | |
39 | end |
|
39 | end | |
40 |
|
40 | |||
41 | def type_label(t) |
|
41 | def type_label(t) | |
42 | l("label_#{t.singularize}_plural", :default => t.to_s.humanize) |
|
42 | l("label_#{t.singularize}_plural", :default => t.to_s.humanize) | |
43 | end |
|
43 | end | |
44 |
|
44 | |||
45 | def project_select_tag |
|
45 | def project_select_tag | |
46 | options = [[l(:label_project_all), 'all']] |
|
46 | options = [[l(:label_project_all), 'all']] | |
47 | options << [l(:label_my_projects), 'my_projects'] unless User.current.memberships.empty? |
|
47 | options << [l(:label_my_projects), 'my_projects'] unless User.current.memberships.empty? | |
@@ -49,7 +49,7 module SearchHelper | |||||
49 | options << [@project.name, ''] unless @project.nil? |
|
49 | options << [@project.name, ''] unless @project.nil? | |
50 | select_tag('scope', options_for_select(options, params[:scope].to_s)) if options.size > 1 |
|
50 | select_tag('scope', options_for_select(options, params[:scope].to_s)) if options.size > 1 | |
51 | end |
|
51 | end | |
52 |
|
52 | |||
53 | def render_results_by_type(results_by_type) |
|
53 | def render_results_by_type(results_by_type) | |
54 | links = [] |
|
54 | links = [] | |
55 | # Sorts types by results count |
|
55 | # Sorts types by results count | |
@@ -57,7 +57,8 module SearchHelper | |||||
57 | c = results_by_type[t] |
|
57 | c = results_by_type[t] | |
58 | next if c == 0 |
|
58 | next if c == 0 | |
59 | text = "#{type_label(t)} (#{c})" |
|
59 | text = "#{type_label(t)} (#{c})" | |
60 |
links << link_to(text, :q => params[:q], :titles_only => params[:titles_only], |
|
60 | links << link_to(h(text), :q => params[:q], :titles_only => params[:titles_only], | |
|
61 | :all_words => params[:all_words], :scope => params[:scope], t => 1) | |||
61 | end |
|
62 | end | |
62 | ('<ul>' + links.map {|link| content_tag('li', link)}.join(' ') + '</ul>') unless links.empty? |
|
63 | ('<ul>' + links.map {|link| content_tag('li', link)}.join(' ') + '</ul>') unless links.empty? | |
63 | end |
|
64 | end |
General Comments 0
You need to be logged in to leave comments.
Login now