This commit is contained in:
BoHung Chiu 2022-11-16 13:09:21 +08:00
parent 2e5d11f9bd
commit a688857e19
1 changed files with 6 additions and 7 deletions

View File

@ -5,7 +5,7 @@ class SiteMenuWidgetsController < ApplicationController
item = {}
item["obj"] = page
is_ip = (page.access_level == 'ip')
next if !page.user_can_access?(@current_user)
next if !is_ip && !page.user_can_access?(@current_user)
if page.child_page.size > 0
item["page_name"] = page.name
item['dropdown'] = 'dropdown-menu'
@ -24,8 +24,7 @@ class SiteMenuWidgetsController < ApplicationController
end
item['active_class'] = (@page_id==page.id ? 'active' : '')
if is_ip
item['url'] = "#{item['url']}\" data-ip=\"true"
item['dropdown'] = "#{item['dropdown']}\" data-ip=\"true"
item['category'] = '" data-ip="true'
end
items << item
end
@ -37,7 +36,7 @@ class SiteMenuWidgetsController < ApplicationController
item = {}
item["obj"] = page
next if !page.user_can_access?(current_user)
next if page.access_level == 'ip' && !@need_process_ip
next if page.access_level == 'ip' && !@need_process_ip && (!(page.always_show_on_menu) rescue true)
if page.child_page.size > 0
item["page_name"] = page.name
item['dropdown'] = 'dropdown-menu'
@ -84,7 +83,7 @@ class SiteMenuWidgetsController < ApplicationController
def widget
subpart = OrbitHelper.get_current_widget
params = OrbitHelper.params
page = Page.where(:page_id => params[:page_id]).first
page = OrbitHelper.page rescue Page.where(:page_id => params[:page_id]).first
@page_id = page.id rescue nil
@expand_layer = false
@expand_next_layer = false
@ -103,7 +102,7 @@ class SiteMenuWidgetsController < ApplicationController
if page.parent_page == Page.root
@pages = page.sorted_published_child_pages
else
@pages = page.parent_page.sorted_published_child_pages
@pages = page.parent_page ? page.parent_page.sorted_published_child_pages : page.sorted_published_child_pages
if subpart.methods.include? 'select_options'.to_sym
@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|
@ -140,7 +139,7 @@ class SiteMenuWidgetsController < ApplicationController
@count1 = -1
@li_index = []
title = subpart.title
if @process_ip_later
if true #@process_ip_later
items = create_json_process_ip_later(@pages)
else
items = create_json(@pages)