diff --git a/lib/decidim/decidim_awesome/engine.rb b/lib/decidim/decidim_awesome/engine.rb index cb74a567f..9ffec8cf2 100644 --- a/lib/decidim/decidim_awesome/engine.rb +++ b/lib/decidim/decidim_awesome/engine.rb @@ -180,6 +180,7 @@ class Engine < ::Rails::Engine end initializer "decidim_decidim_awesome.awesome_admin_menu" do + Decidim::DecidimAwesome::Menu.register_menu_hacks_submenu! Decidim::DecidimAwesome::Menu.register_awesome_admin_menu! end end diff --git a/lib/decidim/decidim_awesome/menu.rb b/lib/decidim/decidim_awesome/menu.rb index 155a0ebea..e3069f503 100644 --- a/lib/decidim/decidim_awesome/menu.rb +++ b/lib/decidim/decidim_awesome/menu.rb @@ -49,10 +49,11 @@ def self.register_awesome_admin_menu! menu.add_item :menu_hacks, I18n.t("menu.menu_hacks", scope: "decidim.decidim_awesome.admin"), - decidim_admin_decidim_awesome.menu_hacks_path, + decidim_admin_decidim_awesome.menu_hacks_path(menus[:menu_hacks_menu] ? :menu : :home_content_block_menu), position: 7, icon_name: "menu-line", - if: menus[:menu_hacks] + if: menus[:menu_hacks], + submenu: { target_menu: :menu_hacks_submenu } menu.add_item :custom_redirects, I18n.t("menu.custom_redirects", scope: "decidim.decidim_awesome.admin"), @@ -76,6 +77,22 @@ def self.register_awesome_admin_menu! end end + def self.register_menu_hacks_submenu! + Decidim.menu :menu_hacks_submenu do |menu| + menu.add_item :main_menu, + I18n.t("menu.title", scope: "decidim.decidim_awesome.admin.menu_hacks.index"), + decidim_admin_decidim_awesome.menu_hacks_path(:menu), + position: 7.1, + if: menus[:menu_hacks_menu] + + menu.add_item :main_menu, + I18n.t("home_content_block_menu.title", scope: "decidim.decidim_awesome.admin.menu_hacks.index"), + decidim_admin_decidim_awesome.menu_hacks_path(:home_content_block_menu), + position: 7.2, + if: menus[:menu_hacks_home_content_block_menu] + end + end + def self.menus @menus ||= { editors: config_enabled?([:allow_images_in_full_editor, :allow_images_in_small_editor, :use_markdown_editor, :allow_images_in_markdown_editor]), @@ -92,7 +109,9 @@ def self.menus styles: config_enabled?(:scoped_styles), proposal_custom_fields: config_enabled?(:proposal_custom_fields), admins: config_enabled?(:scoped_admins), - menu_hacks: config_enabled?(:menu), + menu_hacks: config_enabled?([:menu, :home_content_block_menu]), + menu_hacks_menu: config_enabled?(:menu), + menu_hacks_home_content_block_menu: config_enabled?(:home_content_block_menu), custom_redirects: config_enabled?(:custom_redirects), livechat: config_enabled?([:intergram_for_admins, :intergram_for_public]) }