Class: Arara::DialogButtonComponent

Inherits:
ActionView::Component::Base
  • Object
show all
Includes:
BaseComponent
Defined in:
app/components/arara/dialog_button_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BaseComponent

#default_data_controller, #default_html_tag, #html_class, #html_content, #html_tag, included

Constructor Details

#initialize(dialog_action:, **kw) ⇒ DialogButtonComponent

Returns a new instance of DialogButtonComponent.



8
9
10
11
12
# File 'app/components/arara/dialog_button_component.rb', line 8

def initialize(dialog_action:, **kw)
  super(tag: "button", **kw)

  @dialog_action = dialog_action
end

Instance Attribute Details

#dialog_actionObject (readonly)

Returns the value of attribute dialog_action.



6
7
8
# File 'app/components/arara/dialog_button_component.rb', line 6

def dialog_action
  @dialog_action
end

Instance Method Details

#default_html_classObject



15
16
17
# File 'app/components/arara/dialog_button_component.rb', line 15

def default_html_class
  "mdc-button mdc-dialog__button"
end

#html_dataObject



25
26
27
28
29
# File 'app/components/arara/dialog_button_component.rb', line 25

def html_data
  data = super
  data.merge!('mdc-dialog-action': dialog_action)
  data
end

#html_optionsObject



19
20
21
22
23
# File 'app/components/arara/dialog_button_component.rb', line 19

def html_options
  opts = super
  opts.merge!({type: "button"})
  opts
end