Class: PhlexKit::DataTableSelectionSummary

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/phlex_kit/data_table/data_table_selection_summary.rb

Overview

"N of M row(s) selected." line, kept current by the controller. See data_table.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(total_on_page: 0, **attrs) ⇒ DataTableSelectionSummary

Returns a new instance of DataTableSelectionSummary.



5
6
7
8
# File 'app/components/phlex_kit/data_table/data_table_selection_summary.rb', line 5

def initialize(total_on_page: 0, **attrs)
  @total_on_page = total_on_page
  @attrs = attrs
end

Instance Method Details

#view_templateObject



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

def view_template
  div(**mix({
    class: "pk-data-table-selection-summary",
    role: "status", # live region — selection changes are announced to AT
    data: { phlex_kit__data_table_target: "selectionSummary" }
  }, @attrs)) do
    plain "0 of #{@total_on_page} row(s) selected."
  end
end