Class: PhlexKit::ComboboxToggleAllCheckbox

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/phlex_kit/combobox/combobox_toggle_all_checkbox.rb

Overview

"Select all" checkbox for a multi-select combobox — wrap it in a PhlexKit::ComboboxItem above the list. Hidden while a filter term is active. See combobox.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ ComboboxToggleAllCheckbox

Returns a new instance of ComboboxToggleAllCheckbox.



6
7
8
# File 'app/components/phlex_kit/combobox/combobox_toggle_all_checkbox.rb', line 6

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
# File 'app/components/phlex_kit/combobox/combobox_toggle_all_checkbox.rb', line 10

def view_template
  input(**mix({
    type: :checkbox,
    class: "pk-combobox-checkbox",
    data: {
      phlex_kit__combobox_target: "toggleAll",
      action: "change->phlex-kit--combobox#toggleAllItems"
    }
  }, @attrs))
end