Class: Arara::ChipsetComponent

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

Instance Method Summary collapse

Methods included from BaseComponent

#default_html_tag, #html_class, #html_content, #html_data, #html_options, #html_tag, included

Constructor Details

#initialize(variant: "", selected_chip_ids: [], **kw) ⇒ ChipsetComponent

Returns a new instance of ChipsetComponent.



7
8
9
10
11
# File 'app/components/arara/chipset_component.rb', line 7

def initialize(variant: "", selected_chip_ids: [], **kw)
  @variant = variant
  @selected_chip_ids = selected_chip_ids
  super(tag: "div", variant: variant, **kw)
end

Instance Method Details

#default_data_controllerObject



13
14
15
# File 'app/components/arara/chipset_component.rb', line 13

def default_data_controller
  "mdc-chip-set"
end

#default_html_classObject



17
18
19
20
21
# File 'app/components/arara/chipset_component.rb', line 17

def default_html_class
  return "mdc-chip-set mdc-chip-set--choice" if user_variant == "choice"
  return "mdc-chip-set mdc-chip-set--filter" if user_variant == "filter"
  "mdc-chip-set"
end