This commit is contained in:
BoHung Chiu 2021-05-26 13:39:46 +08:00
parent 3c393b2247
commit a726597605
1 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,6 @@ class SiteMenuWidgetsController < ApplicationController
def create_json(pages)
items = []
pages.each do |page|
next if (!page.menu_enabled_for.include?(I18n.locale.to_s) rescue false
item = {}
item["obj"] = page
if page.child_page.size > 0
@ -65,11 +64,9 @@ class SiteMenuWidgetsController < ApplicationController
else
@pages = page.parent_page.sorted_published_child_pages
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 = orbit_widget.show_options rescue nil
end
@show_options = OrbitWidget.where(:key=>"site_menu_widget").select{|orbit_widget| (orbit_widget.methods.include?(:show_options) rescue false) }.first.show_options rescue nil
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)
if value[I18n.locale] == t('site_menu.yes')
if page.parent_page.parent_page == Page.root
@ -89,10 +86,13 @@ class SiteMenuWidgetsController < ApplicationController
if value[I18n.locale] == t('site_menu.yes')
@expand_layer = true
@expand_next_layer = true
end
end
end
end
end
if @expand_next_layer && !@expand_current_layer
@pages = page.sorted_published_child_pages
end
end
@ul_index=[]
@count = -1