Module: Katalyst::Tables::Identifiable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/components/concerns/katalyst/tables/identifiable.rb
Overview
Adds dom ids to the table and row components. See [documentation](/docs/identifiable.md) for more details.
Defined Under Namespace
Modules: Defaults
Instance Method Summary collapse
- #before_render ⇒ Object
- #id ⇒ Object
- #identifiable? ⇒ Boolean
- #initialize(generate_ids: false) ⇒ Object
Instance Method Details
#before_render ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/components/concerns/katalyst/tables/identifiable.rb', line 38 def before_render if identifiable? update_html_attributes(id: default_table_id(collection)) if id.nil? @body_row_callbacks << Proc.new do |row, record| row.update_html_attributes(id: dom_id(record)) end end super end |
#id ⇒ Object
34 35 36 |
# File 'app/components/concerns/katalyst/tables/identifiable.rb', line 34 def id html_attributes[:id] end |
#identifiable? ⇒ Boolean
30 31 32 |
# File 'app/components/concerns/katalyst/tables/identifiable.rb', line 30 def identifiable? @generate_ids end |
#initialize(generate_ids: false) ⇒ Object
24 25 26 27 28 |
# File 'app/components/concerns/katalyst/tables/identifiable.rb', line 24 def initialize(generate_ids: false, **) super(**) @generate_ids = generate_ids end |