Class: Kpop::ModalComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
Katalyst::HtmlAttributes
Defined in:
app/components/kpop/modal_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(title:, fallback_location: nil, layout: nil, captive: false, **html_attributes) ⇒ ModalComponent

Returns a new instance of ModalComponent.



13
14
15
16
17
18
19
20
21
22
23
# File 'app/components/kpop/modal_component.rb', line 13

def initialize(title:, fallback_location: nil, layout: nil, captive: false, **html_attributes)
  self.content_attributes = html_attributes.delete(:content) if html_attributes.key?(:content)

  super(**html_attributes)

  @fallback_location = fallback_location
  @layout            = layout

  # Generate a title bar. This can be overridden by calling title_bar again.
  with_title(title:, captive:) if title.present?
end

Instance Method Details

#inspectObject



29
30
31
# File 'app/components/kpop/modal_component.rb', line 29

def inspect
  "#<#{self.class.name} title: #{title.inspect}>"
end


25
26
27
# File 'app/components/kpop/modal_component.rb', line 25

def with_footer_buttons(**, &)
  with_footer(class: "button-set", **, &)
end