Adjust feature that page can show on menu to unauthorized users.

This commit is contained in:
BoHung Chiu 2022-11-16 13:10:41 +08:00
parent a688857e19
commit 7464fb4979
1 changed files with 4 additions and 2 deletions

View File

@ -4,8 +4,10 @@ class SiteMenuWidgetsController < ApplicationController
pages.each do |page|
item = {}
item["obj"] = page
if (!(page.always_show_on_menu) rescue true)
is_ip = (page.access_level == 'ip')
next if !is_ip && !page.user_can_access?(@current_user)
end
if page.child_page.size > 0
item["page_name"] = page.name
item['dropdown'] = 'dropdown-menu'