Module: Capybara::ActiveAdmin::Selectors::Table
- Included in:
- Capybara::ActiveAdmin::Selectors
- Defined in:
- lib/capybara/active_admin/selectors/table.rb
Overview
Selectors for table_for, it’s rows and cells.
Instance Method Summary collapse
-
#table_cell_selector(column = nil) ⇒ Object
Selector.
-
#table_header_selector ⇒ Object
Selector.
-
#table_row_selector(record_id = nil) ⇒ Object
Selector.
-
#table_selector(resource_name = nil) ⇒ Object
Selector.
Instance Method Details
#table_cell_selector(column = nil) ⇒ Object
Returns selector.
32 33 34 35 36 37 |
# File 'lib/capybara/active_admin/selectors/table.rb', line 32 def table_cell_selector(column = nil) return 'td.col' if column.nil? column = column.to_s.gsub(' ', '_').downcase "td.col.col-#{column}" end |
#table_header_selector ⇒ Object
Returns selector.
26 27 28 |
# File 'lib/capybara/active_admin/selectors/table.rb', line 26 def table_header_selector 'thead > tr > th.col' end |
#table_row_selector(record_id = nil) ⇒ Object
Returns selector.
19 20 21 22 23 |
# File 'lib/capybara/active_admin/selectors/table.rb', line 19 def table_row_selector(record_id = nil) return 'tbody > tr' if record_id.nil? %(tbody > tr[id$="_#{record_id}"]) end |
#table_selector(resource_name = nil) ⇒ Object
Returns selector.
10 11 12 13 14 15 |
# File 'lib/capybara/active_admin/selectors/table.rb', line 10 def table_selector(resource_name = nil) return 'table.index_table' if resource_name.nil? resource_name = resource_name.to_s.gsub(' ', '_').pluralize.downcase "table#index_table_#{resource_name}" end |