Fix site menu widget cannot only display child pages bug.

This commit is contained in:
BoHung Chiu 2020-05-21 18:01:08 +08:00
parent bf2edc94c2
commit 9e42030f14
1 changed files with 6 additions and 5 deletions

View File

@ -64,11 +64,9 @@ class SiteMenuWidgetsController < ApplicationController
else else
@pages = page.parent_page.sorted_published_child_pages @pages = page.parent_page.sorted_published_child_pages
if subpart.methods.include? 'select_options'.to_sym if subpart.methods.include? 'select_options'.to_sym
OrbitWidget.all.select{|tmp| tmp.key.to_s=='site_menu_widget'}.each do |orbit_widget| @show_options = OrbitWidget.where(:key=>"site_menu_widget").select{|orbit_widget| (orbit_widget.methods.include?(:show_options) rescue false) }.first.show_options rescue nil
@show_options = orbit_widget.show_options rescue nil
end
subpart.select_options.each do |select_option| subpart.select_options.each do |select_option|
if !(@show_options.nil?) && select_option.field_name == @show_options.keys.first.to_s if (!@show_options.nil?) && (select_option.field_name == @show_options.keys.first.to_s)
value = YAML.load(select_option.value) value = YAML.load(select_option.value)
if value[I18n.locale] == t('site_menu.yes') if value[I18n.locale] == t('site_menu.yes')
if page.parent_page.parent_page == Page.root if page.parent_page.parent_page == Page.root
@ -92,6 +90,9 @@ class SiteMenuWidgetsController < ApplicationController
end end
end end
end end
if @expand_next_layer && !@expand_current_layer
@pages = page.child_page
end
end end
@ul_index=[] @ul_index=[]
@count = -1 @count = -1