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