Class: Decidim::DecidimAwesome::Menu
- Inherits:
-
Object
- Object
- Decidim::DecidimAwesome::Menu
- Defined in:
- lib/decidim/decidim_awesome/menu.rb
Class Method Summary collapse
-
.config_enabled?(*vars) ⇒ Boolean
ensure boolean value.
- .menus ⇒ Object
- .register_awesome_admin_menu! ⇒ Object
- .register_custom_fields_submenu! ⇒ Object
- .register_maintenance_admin_menu! ⇒ Object
- .register_menu_hacks_submenu! ⇒ Object
Class Method Details
.config_enabled?(*vars) ⇒ Boolean
ensure boolean value
159 160 161 |
# File 'lib/decidim/decidim_awesome/menu.rb', line 159 def config_enabled?(*vars) DecidimAwesome.enabled?(*vars) end |
.menus ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/decidim/decidim_awesome/menu.rb', line 135 def @menus ||= { editors: config_enabled?(:allow_images_in_editors, :allow_videos_in_editors), proposals: config_enabled?( :allow_images_in_proposals, :validate_title_min_length, :validate_title_max_caps_percent, :validate_title_max_marks_together, :validate_title_start_with_caps, :validate_body_min_length, :validate_body_max_caps_percent, :validate_body_max_marks_together, :validate_body_start_with_caps ), surveys: config_enabled?(:auto_save_forms), styles: config_enabled?(:scoped_styles), proposal_custom_fields: config_enabled?(:proposal_custom_fields), proposal_private_custom_fields: config_enabled?(:proposal_private_custom_fields), admins: config_enabled?(:scoped_admins), 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) } end |
.register_awesome_admin_menu! ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/decidim/decidim_awesome/menu.rb', line 7 def Decidim. :awesome_admin_menu do || .add_item :editors, I18n.t("menu.editors", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:editors), position: 1, icon_name: "editors-text", if: [:editors] .add_item :proposals, I18n.t("menu.proposals", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:proposals), position: 2, icon_name: "documents", if: [:proposals] .add_item :surveys, I18n.t("menu.surveys", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:surveys), position: 3, icon_name: "surveys", if: [:surveys] .add_item :styles, I18n.t("menu.styles", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:styles), position: 4, icon_name: "brush", if: [:styles] .add_item :proposal_custom_fields, I18n.t("menu.proposal_custom_fields", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:proposal_custom_fields), position: 5, icon_name: "layers", if: [:proposal_custom_fields], submenu: { target_menu: :custom_fields_submenu } .add_item :admins, I18n.t("menu.admins", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:admins), position: 6, icon_name: "group-line", if: [:admins] .add_item :menu_hacks, I18n.t("menu.menu_hacks", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.([:menu_hacks_menu] ? :menu : :home_content_block_menu), position: 7, icon_name: "menu-line", if: [:menu_hacks], submenu: { target_menu: :menu_hacks_submenu } .add_item :custom_redirects, I18n.t("menu.custom_redirects", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.custom_redirects_path, position: 8, icon_name: "external-link-line", if: [:custom_redirects] .add_item :livechat, I18n.t("menu.livechat", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:livechat), position: 9, icon_name: "chat-1-line", if: [:livechat] .add_item :maintenance, I18n.t("maintenance", scope: "decidim.decidim_awesome.admin.menu.maintenance"), decidim_admin_decidim_awesome.maintenance_path(:private_data), position: 10, icon_name: "tools-line", submenu: { target_menu: :maintenance_submenu } end end |
.register_custom_fields_submenu! ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/decidim/decidim_awesome/menu.rb', line 83 def Decidim. :custom_fields_submenu do || .add_item :proposal_custom_fields, I18n.t("menu.title", scope: "decidim.decidim_awesome.admin.proposal_custom_fields"), decidim_admin_decidim_awesome.config_path(:proposal_custom_fields), position: 5.1, icon_name: "draft-line", if: [:proposal_custom_fields] .add_item :proposal_private_custom_fields, I18n.t("proposal_private_custom_fields", scope: "decidim.decidim_awesome.admin.proposal_custom_fields"), decidim_admin_decidim_awesome.config_path(:proposal_private_custom_fields), position: 5.2, icon_name: "spy", if: [:proposal_private_custom_fields] end end |
.register_maintenance_admin_menu! ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/decidim/decidim_awesome/menu.rb', line 119 def Decidim. :maintenance_submenu do || .add_item :private_data, I18n.t("private_data", scope: "decidim.decidim_awesome.admin.menu.maintenance"), decidim_admin_decidim_awesome.maintenance_path(:private_data), position: 10, icon_name: "spy-line" .add_item :checks, I18n.t("checks", scope: "decidim.decidim_awesome.admin.menu.maintenance"), decidim_admin_decidim_awesome.checks_maintenance_index_path, position: 10, icon_name: "pulse" end end |
.register_menu_hacks_submenu! ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/decidim/decidim_awesome/menu.rb', line 101 def Decidim. :menu_hacks_submenu do || .add_item :main_menu, I18n.t("menu.title", scope: "decidim.decidim_awesome.admin.menu_hacks.index"), decidim_admin_decidim_awesome.(:menu), position: 7.1, icon_name: "global-line", if: [:menu_hacks_menu] .add_item :content_block_main_menu, I18n.t("home_content_block_menu.title", scope: "decidim.decidim_awesome.admin.menu_hacks.index"), decidim_admin_decidim_awesome.(:home_content_block_menu), position: 7.2, icon_name: "layout-masonry-line", if: [:menu_hacks_home_content_block_menu] end end |