Fix orbit_front parser

This commit is contained in:
chris 2012-12-28 11:51:56 +08:00
parent 0a0298aaad
commit 974a190eaf
1 changed files with 3 additions and 3 deletions

View File

@ -22,13 +22,13 @@ module ParserFrontEnd
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
body = Nokogiri::HTML(page.content)
body.css('orbit_front').each do |front|
if front['class'] && front['class'].include?('dymanic_load')
if front['value']
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div id='#{front['id']}' class='#{front['class']}'>#{eval(front['value']).to_s}</div>")
else
ret = ''
part = PagePart.find(front['part_id']) if front['part_id']
ret << eval("\"#{front['path']}\"") rescue ''
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
else
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div id='#{front['id']}' class='#{front['class']}'>eval('#{front['value']}'').to_s</div>" )
end
front.swap(fragment)
end