Class: Decidim::Core::Menu

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/core/menu.rb

Class Method Summary collapse

Class Method Details

.register_menu!Object



6
7
8
9
10
11
12
13
14
# File 'lib/decidim/core/menu.rb', line 6

def self.register_menu!
  Decidim.menu :menu do |menu|
    menu.add_item :root,
                  I18n.t("menu.home", scope: "decidim"),
                  decidim.root_path,
                  position: 1,
                  active: :exclusive
  end
end

.register_mobile_menu!Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/decidim/core/menu.rb', line 16

def self.register_mobile_menu!
  Decidim.menu :mobile_menu do |menu|
    menu.add_item :root,
                  I18n.t("menu.home", scope: "decidim"),
                  decidim.root_path,
                  position: 1,
                  active: :exclusive

    menu.add_item :help,
                  I18n.t("menu.help", scope: "decidim"),
                  decidim.pages_path,
                  position: 10,
                  active: :exclusive
  end
end

.register_user_menu!Object



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
# File 'lib/decidim/core/menu.rb', line 32

def self.register_user_menu!
  Decidim.menu :user_menu do |menu|
    menu.add_item :account,
                  t("account", scope: "layouts.decidim.user_profile"),
                  decidim.,
                  position: 1.0,
                  active: :exact

    menu.add_item :notifications_settings,
                  t("notifications_settings", scope: "layouts.decidim.user_profile"),
                  decidim.notifications_settings_path,
                  position: 1.1

    if available_verification_workflows.any?
      menu.add_item :authorizations,
                    t("authorizations", scope: "layouts.decidim.user_profile"),
                    decidim_verifications.authorizations_path,
                    position: 1.2
    end

    if current_organization.user_groups_enabled? && user_groups.any?
      menu.add_item :own_user_groups,
                    t("user_groups", scope: "layouts.decidim.user_profile"),
                    decidim.own_user_groups_path,
                    position: 1.3
    end

    menu.add_item :user_interests,
                  t("my_interests", scope: "layouts.decidim.user_profile"),
                  decidim.user_interests_path,
                  position: 1.4

    menu.add_item :download_your_data,
                  t("my_data", scope: "layouts.decidim.user_profile"),
                  decidim.download_your_data_path,
                  position: 1.5

    menu.add_item :delete_account,
                  t("delete_my_account", scope: "layouts.decidim.user_profile"),
                  decidim.,
                  position: 999,
                  active: :exact
  end
end