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) def create_json(pages)
items = [] items = []
pages.each do |page| pages.each do |page|
next if (!page.menu_enabled_for.include?(I18n.locale.to_s) rescue false
item = {} item = {}
item["obj"] = page item["obj"] = page
if page.child_page.size > 0 if page.child_page.size > 0
@ -65,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
@ -93,6 +90,9 @@ class SiteMenuWidgetsController < ApplicationController
end end
end end
end end
if @expand_next_layer && !@expand_current_layer
@pages = page.sorted_published_child_pages
end
end end
@ul_index=[] @ul_index=[]
@count = -1 @count = -1