Put missing changes for breadcrumb in page edit

This commit is contained in:
chris 2013-02-05 18:38:09 +08:00
parent 61648d23e1
commit f36bcb8801
1 changed files with 10 additions and 7 deletions

View File

@ -150,17 +150,20 @@ module ParserCommon
ancestors = Page.find(page.id).ancestors_and_self rescue nil
ancestors.delete_at(0)
res = ''
if ancestors
res << "<div class='category_list'>"
res << "<ul class='list'>"
ancestors.each do |node|
res << "<li class='active'>"
res << "<ul class='breadcrumb'>"
ancestors.each_with_index do |node, i|
last = i == ancestors.size-1
res << "<li class=#{'active' if last}>"
if last
res << node.title
else
res << "<a herf='/#{node.path}'>#{node.title}</a>"
res << "<span class='divider'>/</span>"
end
res << "</li>"
end
res << "</ul>"
res << "</div>"
end
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
breadcrumb.swap(fragment)