Module: Capybara::ActiveAdmin::Finders::Form

Included in:
Capybara::ActiveAdmin::Finders
Defined in:
lib/capybara/active_admin/finders/form.rb

Overview

Finders for active_admin_form_for and related form components.

Instance Method Summary collapse

Instance Method Details

#within_filters { ... } ⇒ Object

Yields:

  • within filters container.



26
27
28
29
# File 'lib/capybara/active_admin/finders/form.rb', line 26

def within_filters
  selector = filter_form_selector
  within(selector) { yield }
end

#within_form_for(model_name = nil) { ... } ⇒ Object

Parameters:

  • model_name (Class<Object>, String, nil) (defaults to: nil)

    form record class or model name (default nil).

Yields:

  • within form



10
11
12
13
# File 'lib/capybara/active_admin/finders/form.rb', line 10

def within_form_for(model_name = nil)
  selector = form_selector(model_name)
  within(selector) { yield }
end

#within_form_has_many(association_name, index: 0) { ... } ⇒ Object

Parameters:

  • association_name (String)
  • index (String) (defaults to: 0)

    index of fieldset, starts with 0 (default 0).

Yields:

  • within fieldset>ol



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

def within_form_has_many(association_name, index: 0)
  selector = has_many_fields_selector(association_name)
  fieldset = find_all(selector, minimum: index + 1)[index]

  within(fieldset) { yield }
end