Fix for parser sub_menu

Add style to the sub_menu
This commit is contained in:
Christophe Vilayphiou 2012-04-24 11:26:36 +08:00
parent 8041452be5
commit f05b7db73a
1 changed files with 5 additions and 1 deletions

View File

@ -110,13 +110,17 @@ module ParserCommon
def parse_sub_menus(body = nil, page = nil, id = nil) def parse_sub_menus(body = nil, page = nil, id = nil)
body.css('sub_menu').each do |sub_menu| body.css('sub_menu').each do |sub_menu|
res = '' res = ''
res << "<ul>" res << "<div class='category_list'>"
res << "<h3 class='h3'>#{page.i18n_variable[I18n.locale]}</h3>"
res << "<ul class='list'>"
page.children.each do |child| page.children.each do |child|
res << "<li>" res << "<li>"
res << "<a href='#{child.full_name}'>#{child.i18n_variable[I18n.locale]}</a>" res << "<a href='#{child.full_name}'>#{child.i18n_variable[I18n.locale]}</a>"
res << "</li>" res << "</li>"
end end
res << "</ul>" res << "</ul>"
res << "</h3>"
res << "</div>"
fragment = Nokogiri::HTML::DocumentFragment.new(body, res) fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
sub_menu.swap(fragment) sub_menu.swap(fragment)
end end