front_end widget breadcrumb done
This commit is contained in:
parent
2a61470f8b
commit
bca4478f68
|
@ -3,7 +3,7 @@ class FrontController < ApplicationController
|
|||
layout false
|
||||
|
||||
def show_breadcrumb
|
||||
@ancestors = Page.find(params[:menu_page_id]).ancestors_and_self.map{|m|m.title_translations[locale]}.delete_at(0) rescue []
|
||||
@ancestors = Page.find(params[:page_id]).ancestors_and_self
|
||||
@ancestors.delete_at(0)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<% if not @ancestors.empty? %>
|
||||
<div class='category_list'>
|
||||
<ul class='list'>
|
||||
<%= @ancestors.each do |node| %>
|
||||
<% @ancestors.each do |node| %>
|
||||
<li class='active'>
|
||||
<%= link_to node.title, (node.class.to_s.eql?('Page') ? '/' + node.path : node.url) %>
|
||||
<%= link_to node.title, "/#{node.path}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -156,9 +156,7 @@ module ParserCommon
|
|||
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 << "<a herf ='/#{node.path} )}>#{node}</a>"
|
||||
res << "</li>"
|
||||
end
|
||||
res << "</ul>"
|
||||
|
@ -209,6 +207,7 @@ module ParserCommon
|
|||
''
|
||||
end
|
||||
end
|
||||
|
||||
# sitemap
|
||||
def parse_sitemaps_edit(body = nil, page = nil, edit=nil)
|
||||
sitemap = body.css('sitemap').first
|
||||
|
|
|
@ -11,6 +11,7 @@ module ParserFrontEnd
|
|||
parse_images(body, page)
|
||||
parse_menu(body, page)
|
||||
parse_sub_menu(body, page, site)
|
||||
parse_breadcrumb(body, page, site)
|
||||
parse_counter(body)
|
||||
i18n.merge!({locale => body.to_html})
|
||||
end
|
||||
|
@ -92,6 +93,20 @@ module ParserFrontEnd
|
|||
end
|
||||
end
|
||||
|
||||
# page_breadcrumb
|
||||
def parse_breadcrumb(body, page, site)
|
||||
page_breadcrumb = body.css('.page_breadcrumb').first
|
||||
if page_breadcrumb
|
||||
res = "<div id='#{page_breadcrumb['id']}', class='#{page_breadcrumb['class']}'>"
|
||||
res << "<div class='dymanic_load' path='#{front_show_site_breadcrumb_path}'></div>"
|
||||
res << "</div>"
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
|
||||
page_breadcrumb.swap(fragment)
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
# page_contents
|
||||
def parse_contents(body, page, edit=nil, locale)
|
||||
public_r_tags = []
|
||||
|
@ -181,6 +196,6 @@ module ParserFrontEnd
|
|||
|
||||
# breadcrumb
|
||||
def generate_breadcrumbs(*args)
|
||||
"<div class='dymanic_load' path='#{front_show_breadcrumb_path({:menu_page_id => args[0], :page_id => args[1]})}'></div>"
|
||||
"<div class='dymanic_load' path='#{front_show_breadcrumb_path(args[1])}'></div>"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue