back_end widget breadcrumb finish
This commit is contained in:
1 parent
0b88f7d1f8
commit
2a61470f8b
10 files changed
+69
-1048
No files matched your search
@@ -30,6 +30,7 @@ module ParserBackEnd
|
||||
parse_images_edit(body, page)
|
||||
parse_footer_edit(body, page)
|
||||
parse_sub_menu_edit(body, page)
|
||||
parse_breadcrumb_edit(body, page)
|
||||
parse_counter_edit(body)
|
||||
public_r_tags.each do |tag|
|
||||
send("parse_#{tag}s_edit", body, page, true)
|
||||
|
||||
@@ -144,6 +144,31 @@ module ParserCommon
|
||||
end
|
||||
end
|
||||
|
||||
# breadcrumb
|
||||
def parse_breadcrumbs_edit(body = nil, page = nil, edit=nil)
|
||||
body.css('breadcrumb').each do |breadcrumb|
|
||||
ancestors = Page.find(page.id).ancestors_and_self.map{|m|m.title} 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'>"
|
||||
# root = "/"
|
||||
# res << "<a href='#{edit ? root + admin_page_path(child.id) : (child.class.to_s.eql?('Page') ? root + child.path : child.url)}'>#{child.title}</a>"
|
||||
res << "<a herf ='/' + node.path )}>#{node}</a>"
|
||||
res << "</li>"
|
||||
end
|
||||
res << "</ul>"
|
||||
res << "</div>"
|
||||
end
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
|
||||
breadcrumb.swap(fragment)
|
||||
end
|
||||
end
|
||||
|
||||
# page_footer
|
||||
def parse_footer_edit(body, page)
|
||||
page_footer = body.css('.page_footer').first
|
||||
@@ -172,6 +197,18 @@ module ParserCommon
|
||||
end
|
||||
end
|
||||
|
||||
def parse_breadcrumb_edit(body, page)
|
||||
page_breadcrumb = body.css('.page_breadcrumb').first
|
||||
if page_breadcrumb
|
||||
res = "<div id='#{page_breadcrumb['id']}', class='#{page_breadcrumb['class']}'>"
|
||||
res << @site.breadcrumb rescue nil
|
||||
res << "</div>"
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
|
||||
page_breadcrumb.swap(fragment) rescue nil
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
# sitemap
|
||||
def parse_sitemaps_edit(body = nil, page = nil, edit=nil)
|
||||
sitemap = body.css('sitemap').first
|
||||
|
||||
@@ -178,5 +178,9 @@ module ParserFrontEnd
|
||||
def generate_sub_menus(*args)
|
||||
"<div class='dymanic_load' path='#{front_show_page_sub_menu_path({:menu_page_id => args[0], :page_id => args[1]})}'></div>"
|
||||
end
|
||||
|
||||
|
||||
# breadcrumb
|
||||
def generate_breadcrumbs(*args)
|
||||
"<div class='dymanic_load' path='#{front_show_breadcrumb_path({:menu_page_id => args[0], :page_id => args[1]})}'></div>"
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user