Class: Impulse::PopoverComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/impulse/popover_component.rb

Instance Method Summary collapse

Methods inherited from ApplicationComponent

generate_id

Methods included from Helpers::AttributesHelper

#merge_attributes

Constructor Details

#initialize(title: nil, click_boundaries: [], **system_args) ⇒ PopoverComponent

Returns a new instance of PopoverComponent.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/components/impulse/popover_component.rb', line 32

def initialize(title: nil, click_boundaries: [], **system_args)
  @title = title
  @system_args = system_args
  @system_args[:tag] = :"awc-popover"
  @system_args[:"click-boundaries"] = click_boundaries.to_json
  @panel_id = self.class.generate_id

  @system_args[:class] = class_names(
    system_args[:class],
    "awc-popover"
  )

  @system_args[:data] = merge_attributes(
    system_args[:data],
    action: "keydown->awc-popover#handleKeydown"
  )
end

Instance Method Details

#before_renderObject



54
55
56
# File 'app/components/impulse/popover_component.rb', line 54

def before_render
  with_header unless header?
end

#render?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'app/components/impulse/popover_component.rb', line 50

def render?
  trigger.present?
end