back_end widget breadcrumb finish
This commit is contained in:
parent
0b88f7d1f8
commit
2a61470f8b
3
Gemfile
3
Gemfile
|
@ -76,8 +76,8 @@ group :test, :development do
|
||||||
gem 'pry-remote'
|
gem 'pry-remote'
|
||||||
gem 'pry-stack_explorer'
|
gem 'pry-stack_explorer'
|
||||||
gem 'pry-debugger'
|
gem 'pry-debugger'
|
||||||
|
gem 'debugger'
|
||||||
gem 'faker'
|
gem 'faker'
|
||||||
|
|
||||||
gem "sunspot-rails-tester"
|
gem "sunspot-rails-tester"
|
||||||
gem 'database_cleaner' #Strategies for cleaning databases. Can be used to ensure a clean state for testing.
|
gem 'database_cleaner' #Strategies for cleaning databases. Can be used to ensure a clean state for testing.
|
||||||
gem "rspec", "~> 2.0"
|
gem "rspec", "~> 2.0"
|
||||||
|
@ -93,4 +93,3 @@ group :test, :development do
|
||||||
# gem "bluecloth"
|
# gem "bluecloth"
|
||||||
end
|
end
|
||||||
|
|
||||||
gem 'debugger'
|
|
||||||
|
|
|
@ -2,6 +2,11 @@ class FrontController < ApplicationController
|
||||||
|
|
||||||
layout false
|
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.delete_at(0)
|
||||||
|
end
|
||||||
|
|
||||||
def show_banner
|
def show_banner
|
||||||
@ad_banner = AdBanner.find(params[:id]) rescue nil
|
@ad_banner = AdBanner.find(params[:id]) rescue nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %>
|
<%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %>
|
||||||
<%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %>
|
<%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %>
|
||||||
<% elsif @r_tag.eql?('sitemap') %>
|
<% elsif @r_tag.eql?('sitemap') %>
|
||||||
|
<% elsif @r_tag.eql?('breadcrumb') %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %>
|
<%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<% if not @ancestors.empty? %>
|
||||||
|
<div class='category_list'>
|
||||||
|
<ul class='list'>
|
||||||
|
<%= @ancestors.each do |node| %>
|
||||||
|
<li class='active'>
|
||||||
|
<%= link_to node.title, (node.class.to_s.eql?('Page') ? '/' + node.path : node.url) %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -42,6 +42,7 @@ public_r_tags:
|
||||||
- ad_banner
|
- ad_banner
|
||||||
- sub_menu
|
- sub_menu
|
||||||
- sitemap
|
- sitemap
|
||||||
|
- breadcrumb
|
||||||
|
|
||||||
page_part_kinds:
|
page_part_kinds:
|
||||||
- text
|
- text
|
||||||
|
|
|
@ -255,7 +255,7 @@ Orbit::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
controller_paths :front, %w[show_banner show_footer show_menu show_page_sub_menu show_site_sub_menu show_sitemap]
|
controller_paths :front, %w[show_breadcrumb show_banner show_footer show_menu show_page_sub_menu show_site_sub_menu show_sitemap]
|
||||||
# controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content]
|
# controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content]
|
||||||
|
|
||||||
# scope 'app' do
|
# scope 'app' do
|
||||||
|
|
|
@ -30,6 +30,7 @@ module ParserBackEnd
|
||||||
parse_images_edit(body, page)
|
parse_images_edit(body, page)
|
||||||
parse_footer_edit(body, page)
|
parse_footer_edit(body, page)
|
||||||
parse_sub_menu_edit(body, page)
|
parse_sub_menu_edit(body, page)
|
||||||
|
parse_breadcrumb_edit(body, page)
|
||||||
parse_counter_edit(body)
|
parse_counter_edit(body)
|
||||||
public_r_tags.each do |tag|
|
public_r_tags.each do |tag|
|
||||||
send("parse_#{tag}s_edit", body, page, true)
|
send("parse_#{tag}s_edit", body, page, true)
|
||||||
|
|
|
@ -144,6 +144,31 @@ module ParserCommon
|
||||||
end
|
end
|
||||||
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
|
# page_footer
|
||||||
def parse_footer_edit(body, page)
|
def parse_footer_edit(body, page)
|
||||||
page_footer = body.css('.page_footer').first
|
page_footer = body.css('.page_footer').first
|
||||||
|
@ -172,6 +197,18 @@ module ParserCommon
|
||||||
end
|
end
|
||||||
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
|
# sitemap
|
||||||
def parse_sitemaps_edit(body = nil, page = nil, edit=nil)
|
def parse_sitemaps_edit(body = nil, page = nil, edit=nil)
|
||||||
sitemap = body.css('sitemap').first
|
sitemap = body.css('sitemap').first
|
||||||
|
|
|
@ -179,4 +179,8 @@ module ParserFrontEnd
|
||||||
"<div class='dymanic_load' path='#{front_show_page_sub_menu_path({:menu_page_id => args[0], :page_id => args[1]})}'></div>"
|
"<div class='dymanic_load' path='#{front_show_page_sub_menu_path({:menu_page_id => args[0], :page_id => args[1]})}'></div>"
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue