module Capybara::ActiveAdmin::Selectors::Table

Selectors for table_for, it's rows and cells.

Public Instance Methods

table_cell_selector(column = nil) click to toggle source

@param column [String, nil] column name. @return selector.

# 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() click to toggle source

@return selector.

# 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) click to toggle source

@param record_id [String, Integer, nil] record ID. @return selector.

# 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) click to toggle source

@param resource_name [String, nil] active admin resource name. @return selector.

# 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