Add footer parser

This commit is contained in:
Christophe Vilayphiou 2012-05-07 13:33:29 +08:00
parent 0246341aef
commit e52119e258
3 changed files with 14 additions and 1 deletions

View File

@ -28,6 +28,7 @@ module ParserBackEnd
parse_menu(body, page, true) parse_menu(body, page, true)
public_r_tags = parse_content_edits(body, page, id) public_r_tags = parse_content_edits(body, page, id)
parse_images(body, page) parse_images(body, page)
parse_footer(body, page, true)
public_r_tags.each do |tag| public_r_tags.each do |tag|
send("parse_#{tag}s", body, page,id) send("parse_#{tag}s", body, page,id)

View File

@ -1,5 +1,6 @@
module ParserCommon module ParserCommon
include ActionView::Helpers::TagHelper
def menu_level(page, current, menu, edit = false) def menu_level(page, current, menu, edit = false)
res = '' res = ''
if menu.levels > 0 && current <= menu.levels if menu.levels > 0 && current <= menu.levels
@ -127,4 +128,14 @@ module ParserCommon
end end
end end
# page_menu
def parse_footer(body, page, edit=nil)
page_footer = body.css('.page_footer').first
res = "<div, id='footer', class='footer'>"
res << @site.footer[I18n.locale]
res << "</div>"
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
page_footer.swap(fragment)
end
end end

View File

@ -26,6 +26,7 @@ module ParserFrontEnd
parse_menu(body, page) parse_menu(body, page)
public_r_tags = parse_contents(body, page, id,params[:preview]) public_r_tags = parse_contents(body, page, id,params[:preview])
parse_images(body, page) parse_images(body, page)
parse_footer(body, page, true)
public_r_tags.each do |tag| public_r_tags.each do |tag|
send("parse_#{tag}s", body, page,id) send("parse_#{tag}s", body, page,id)