Announcement preivew

This commit is contained in:
Matthew K. Fu JuYuan committed 2012-05-03 14:57:10 +08:00
1 parent de457e7dfc
commit 2a14c8bad4
16 files changed
+124 -45

No files matched your search

+4 -3
View File
@@ -21,10 +21,10 @@ module ParserFrontEnd
require 'nokogiri'
def parse_page_noko(page, id = nil)
def parse_page_noko(page, id = nil,params)
body = Nokogiri::HTML(page.design.layout.body)
parse_menu(body, page)
public_r_tags = parse_contents(body, page, id)
public_r_tags = parse_contents(body, page, id,params[:preview])
parse_images(body, page)
public_r_tags.each do |tag|
@@ -35,7 +35,7 @@ module ParserFrontEnd
end
# page_contents
def parse_contents(body, page, id)
def parse_contents(body, page, id,preview = false)
public_r_tags = []
body.css('.page_content').each do |content|
ret = ''
@@ -44,6 +44,7 @@ module ParserFrontEnd
ret << "/#{id}" if id
ret << "?inner=true&page_id=#{page.id}"
ret << "&category_id=#{page.category}" if page[:category]
ret << "&preview=true" if preview
ret << "'></div>"
else
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil