Class: Panda::Core::Admin::SlideoverComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/panda/core/admin/slideover_component.rb

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title: "Settings", open: false, **attrs) ⇒ SlideoverComponent

Returns a new instance of SlideoverComponent.



9
10
11
12
13
# File 'app/components/panda/core/admin/slideover_component.rb', line 9

def initialize(title: "Settings", open: false, **attrs)
  @title = title
  @open = open
  super(**attrs)
end

Instance Attribute Details

#openObject (readonly)

Returns the value of attribute open.



15
16
17
# File 'app/components/panda/core/admin/slideover_component.rb', line 15

def open
  @open
end

#titleObject (readonly)

Returns the value of attribute title.



15
16
17
# File 'app/components/panda/core/admin/slideover_component.rb', line 15

def title
  @title
end

Instance Method Details

#before_renderObject



17
18
19
20
21
22
23
# File 'app/components/panda/core/admin/slideover_component.rb', line 17

def before_render
  # Store main content if provided
  # In ViewComponent, content is already rendered HTML (SafeBuffer), not a block
  if content.present?
    @content_html = content
  end
end

Legacy method for backwards compatibility



26
27
28
29
30
31
32
# File 'app/components/panda/core/admin/slideover_component.rb', line 26

def footer(&block)
  if defined?(view_context) && view_context
    @footer_html = view_context.capture(&block)
  else
    @footer_block = block
  end
end