Class: Avo::SidebarComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/avo/sidebar_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(sidebar_open: nil, for_mobile: false) ⇒ SidebarComponent

Returns a new instance of SidebarComponent.



4
5
6
7
# File 'app/components/avo/sidebar_component.rb', line 4

def initialize(sidebar_open: nil, for_mobile: false)
  @sidebar_open = sidebar_open
  @for_mobile = for_mobile
end

Instance Method Details

#dashboardsObject



9
10
11
12
13
# File 'app/components/avo/sidebar_component.rb', line 9

def dashboards
  return [] unless Avo.plugin_manager.installed?("avo-dashboards")

  Avo::Dashboards.dashboard_manager.dashboards_for_navigation
end

#resourcesObject



15
16
17
# File 'app/components/avo/sidebar_component.rb', line 15

def resources
  Avo.resource_manager.resources_for_navigation helpers._current_user
end

#stimulus_targetObject



23
24
25
# File 'app/components/avo/sidebar_component.rb', line 23

def stimulus_target
  @for_mobile ? "mobileSidebar" : "sidebar"
end

#toolsObject



19
20
21
# File 'app/components/avo/sidebar_component.rb', line 19

def tools
  Avo.tool_manager.tools_for_navigation
end