Class: Panda::Core::Admin::SidebarComponent
- Defined in:
- app/components/panda/core/admin/sidebar_component.rb
Overview
Sidebar navigation component for admin pages Displays hierarchical navigation with toggle for nested items. Supports optional section grouping via the :section key on nav items.
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #admin_logo ⇒ Object
- #admin_logo_actions ⇒ Object
- #admin_settings_path ⇒ Object
- #compact_navigation? ⇒ Boolean
-
#initialize(user:, **attrs) ⇒ SidebarComponent
constructor
A new instance of SidebarComponent.
- #safe_html(value) ⇒ Object
- #sectioned?(items) ⇒ Boolean
Constructor Details
#initialize(user:, **attrs) ⇒ SidebarComponent
Returns a new instance of SidebarComponent.
10 11 12 13 |
# File 'app/components/panda/core/admin/sidebar_component.rb', line 10 def initialize(user:, **attrs) @user = user super(**attrs) end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
15 16 17 |
# File 'app/components/panda/core/admin/sidebar_component.rb', line 15 def user @user end |
Instance Method Details
#admin_logo ⇒ Object
17 18 19 |
# File 'app/components/panda/core/admin/sidebar_component.rb', line 17 def admin_logo Panda::Core.config.admin_logo end |
#admin_logo_actions ⇒ Object
29 30 31 |
# File 'app/components/panda/core/admin/sidebar_component.rb', line 29 def admin_logo_actions Panda::Core.config.admin_logo_actions || [] end |
#admin_settings_path ⇒ Object
21 22 23 |
# File 'app/components/panda/core/admin/sidebar_component.rb', line 21 def admin_settings_path Panda::Core.config.admin_settings_path end |
#compact_navigation? ⇒ Boolean
25 26 27 |
# File 'app/components/panda/core/admin/sidebar_component.rb', line 25 def Panda::Core.config. end |
#safe_html(value) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/components/panda/core/admin/sidebar_component.rb', line 37 def safe_html(value) raw = value.respond_to?(:call) ? value.call : value helpers.sanitize(raw, tags: %w[svg path ellipse circle rect line polyline polygon g defs use span a i div img br strong em b], attributes: %w[ viewBox fill stroke stroke-width stroke-linecap stroke-linejoin opacity cx cy rx ry r x y x1 y1 x2 y2 width height d points transform xmlns class href style id data-turbo-track rel ]) end |
#sectioned?(items) ⇒ Boolean
33 34 35 |
# File 'app/components/panda/core/admin/sidebar_component.rb', line 33 def sectioned?(items) items.any? { |item| item[:section].present? } end |