Class: IronAdmin::Layout::ShellComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/iron_admin/layout/shell_component.rb

Overview

Renders the main admin panel shell with sidebar and navbar.

Instance Method Summary collapse

Constructor Details

#initialize(current_user: nil) ⇒ ShellComponent

Returns a new instance of ShellComponent.

Parameters:

  • current_user (Object, nil) (defaults to: nil)

    Current user



12
13
14
# File 'app/components/iron_admin/layout/shell_component.rb', line 12

def initialize(current_user: nil)
  @current_user = current_user
end

Instance Method Details

#before_rendervoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Sets up default sidebar and navbar if not provided.



19
20
21
22
# File 'app/components/iron_admin/layout/shell_component.rb', line 19

def before_render
  with_sidebar unless sidebar?
  with_navbar(current_user: @current_user) unless navbar?
end