Module: Capybara::ActiveAdmin::Selectors::AttributesTable

Included in:
Capybara::ActiveAdmin::Selectors
Defined in:
lib/capybara/active_admin/selectors/attributes_table.rb

Instance Method Summary collapse

Instance Method Details

#attributes_row_selector(label = nil) ⇒ String

Returns selector.

Returns:

  • (String)

    selector.



18
19
20
21
22
23
# File 'lib/capybara/active_admin/selectors/attributes_table.rb', line 18

def attributes_row_selector(label = nil)
  return 'tr.row > td' if label.nil?

  label = label.to_s.gsub(' ', '_').downcase
  "tr.row.row-#{label} > td"
end

#attributes_table_selector(model: nil, id: nil) ⇒ String

Returns selector.

Returns:

  • (String)

    selector.



8
9
10
11
12
13
14
15
# File 'lib/capybara/active_admin/selectors/attributes_table.rb', line 8

def attributes_table_selector(model: nil, id: nil)
  return 'div.attributes_table' if model.nil?

  model = Util.parse_model_name(model)
  selector = "div.attributes_table.#{model}"
  selector += "#attributes_table_#{model}_#{id}" if id
  selector
end