关键字查询会丢失样式

This commit is contained in:
lizanle 2015-01-30 11:52:37 +08:00
parent 852bb940a2
commit e761cd5f22
1 changed files with 4 additions and 1 deletions

View File

@ -25,7 +25,10 @@ module SystemLogHelper
logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) }
#将分页后的记录的搜索结果添加样式,样式中的\0是给给r占位置的。
logs.collect! do |log|
keywords.each { |r| log.gsub!(r, '<span class="search_results">\0</span>') && log = "" if log =~ Regexp.new("SystemLogController",'i') }
if log =~ Regexp.new("SystemLogController",'i')
log = ""
end
keywords.each { |r| log.gsub!(r, '<span class="search_results">\0</span>') }
log
end