@@ -26,7 +26,12 module SearchHelper | |||
|
26 | 26 | result << '...' |
|
27 | 27 | break |
|
28 | 28 | end |
|
29 | result << (i.even? ? h(words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) : content_tag('span', h(words), :class => 'highlight')) | |
|
29 | if i.even? | |
|
30 | result << h(words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) | |
|
31 | else | |
|
32 | t = (tokens.index(words.downcase) || 0) % 4 | |
|
33 | result << content_tag('span', h(words), :class => "highlight token-#{t}") | |
|
34 | end | |
|
30 | 35 | end |
|
31 | 36 | result |
|
32 | 37 | end |
@@ -9,7 +9,7 | |||
|
9 | 9 | <label><%= check_box_tag t, 1, @scope.include?(t) %> <%= l("label_#{t.singularize}_plural")%></label> |
|
10 | 10 | <% end %> |
|
11 | 11 | <br /> |
|
12 | <%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></p> | |
|
12 | <label><%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></label></p> | |
|
13 | 13 | <%= submit_tag l(:button_submit), :name => 'submit' %> |
|
14 | 14 | <% end %> |
|
15 | 15 | </div> |
@@ -83,6 +83,9 table p {margin:0;} | |||
|
83 | 83 | .even {background-color: #fff;} |
|
84 | 84 | |
|
85 | 85 | .highlight { background-color: #FCFD8D;} |
|
86 | .highlight.token-1 { background-color: #faa;} | |
|
87 | .highlight.token-2 { background-color: #afa;} | |
|
88 | .highlight.token-3 { background-color: #aaf;} | |
|
86 | 89 | |
|
87 | 90 | .box{ |
|
88 | 91 | padding:6px; |
General Comments 0
You need to be logged in to leave comments.
Login now