diff options
-rw-r--r-- | app/helpers/search_helper.rb | 7 | ||||
-rw-r--r-- | app/views/search/index.rhtml | 2 | ||||
-rw-r--r-- | public/stylesheets/application.css | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 75412c70a..ed2f40b69 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -26,7 +26,12 @@ module SearchHelper result << '...' break end - result << (i.even? ? h(words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) : content_tag('span', h(words), :class => 'highlight')) + if i.even? + result << h(words.length > 100 ? "#{words[0..44]} ... #{words[-45..-1]}" : words) + else + t = (tokens.index(words.downcase) || 0) % 4 + result << content_tag('span', h(words), :class => "highlight token-#{t}") + end end result end diff --git a/app/views/search/index.rhtml b/app/views/search/index.rhtml index 4dc26affd..4bf80f054 100644 --- a/app/views/search/index.rhtml +++ b/app/views/search/index.rhtml @@ -9,7 +9,7 @@ <label><%= check_box_tag t, 1, @scope.include?(t) %> <%= l("label_#{t.singularize}_plural")%></label>
<% end %>
<br />
-<%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></p>
+<label><%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></label></p>
<%= submit_tag l(:button_submit), :name => 'submit' %>
<% end %>
</div>
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 9bae7bcd9..1ae20416a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -83,6 +83,9 @@ table p {margin:0;} .even {background-color: #fff;} .highlight { background-color: #FCFD8D;} +.highlight.token-1 { background-color: #faa;} +.highlight.token-2 { background-color: #afa;} +.highlight.token-3 { background-color: #aaf;} .box{ padding:6px; |