Module: Decidim::MenuHelper

Included in:
ContentBlocks::GlobalMenuCell
Defined in:
decidim-core/app/helpers/decidim/menu_helper.rb

Overview

This module includes helpers to manage menus in layout

Instance Method Summary collapse

Instance Method Details



38
39
40
41
42
43
44
# File 'decidim-core/app/helpers/decidim/menu_helper.rb', line 38

def breadcrumb_root_menu
  @breadcrumb_root_menu ||= ::Decidim::BreadcrumbRootMenuPresenter.new(
    :menu,
    self,
    container_options: { class: "menu-bar__main-dropdown__menu" }
  )
end


46
47
48
49
50
51
52
53
54
55
# File 'decidim-core/app/helpers/decidim/menu_helper.rb', line 46

def footer_menu
  @footer_menu ||= ::Decidim::FooterMenuPresenter.new(
    :menu,
    self,
    element_class: "font-semibold underline",
    active_class: "is-active",
    container_options: { class: "space-y-4 break-inside-avoid" },
    label: t("layouts.decidim.footer.decidim_title")
  )
end

#home_content_block_menuObject



65
66
67
68
69
70
71
72
73
# File 'decidim-core/app/helpers/decidim/menu_helper.rb', line 65

def home_content_block_menu
  @home_content_block_menu ||= ::Decidim::MenuPresenter.new(
    :home_content_block_menu,
    self,
    element_class: "main-nav__link",
    active_class: "main-nav__link--active",
    label: t("layouts.decidim.header.main_menu")
  )
end

Public: Returns the main menu presenter object



7
8
9
10
11
12
13
14
15
# File 'decidim-core/app/helpers/decidim/menu_helper.rb', line 7

def main_menu
  @main_menu ||= ::Decidim::MenuPresenter.new(
    :menu,
    self,
    element_class: "main-nav__link",
    active_class: "main-nav__link--active",
    label: t("layouts.decidim.header.main_menu")
  )
end


17
18
19
20
21
22
23
24
25
# File 'decidim-core/app/helpers/decidim/menu_helper.rb', line 17

def main_menu_modules
  @main_menu ||= ::Decidim::MenuPresenter.new(
    :menu,
    self,
    element_class: "main-nav__link-modules",
    active_class: "main-nav__link-modules--active",
    label: t("layouts.decidim.header.main_menu")
  )
end


57
58
59
60
61
62
63
# File 'decidim-core/app/helpers/decidim/menu_helper.rb', line 57

def menu_highlighted_participatory_process
  @menu_highlighted_participatory_process ||= (
    # The queries already include the order by weight
    Decidim::ParticipatoryProcesses::OrganizationParticipatoryProcesses.new(current_organization) |
    Decidim::ParticipatoryProcesses::PromotedParticipatoryProcesses.new
  ).first
end

#user_menuObject

Public: Returns the user menu presenter object



28
29
30
31
32
33
34
35
36
# File 'decidim-core/app/helpers/decidim/menu_helper.rb', line 28

def user_menu
  @user_menu ||= ::Decidim::InlineMenuPresenter.new(
    :user_menu,
    self,
    element_class: "tabs-title",
    active_class: "is-active",
    label: t("layouts.decidim.user_menu.title")
  )
end