module Capybara::ActiveAdmin::Selectors::Form

Selectors for active_admin_form_for and related form components.

Public Instance Methods

filter_form_selector() click to toggle source

@return [String] selector.

# File lib/capybara/active_admin/selectors/form.rb, line 59
def filter_form_selector
  '.filter_form'
end
form_selector(model_name = nil) click to toggle source

@param model_name [String, nil] form model name @return [String] selector.

# File lib/capybara/active_admin/selectors/form.rb, line 10
def form_selector(model_name = nil)
  return 'form.formtastic' if model_name.nil?

  model_name = Util.parse_model_name(model_name, singular: true)
  "form.formtastic.#{model_name}"
end
form_submit_selector(text = nil) click to toggle source

@param text [String, nil] submit button text. @return [String] selector.

# File lib/capybara/active_admin/selectors/form.rb, line 40
def form_submit_selector(text = nil)
  return %(input[type="submit"]) if text.nil?

  %(input[type="submit"][value="#{text}"])
end
has_many_fields_selector(association_name) click to toggle source

@param association_name [String] @return [String] selector.

# File lib/capybara/active_admin/selectors/form.rb, line 34
def has_many_fields_selector(association_name)
  "div.has_many_container.#{association_name} > fieldset.inputs.has_many_fields"
end
inline_error_selector() click to toggle source

@return [String] selector.

# File lib/capybara/active_admin/selectors/form.rb, line 23
def inline_error_selector
  'p.inline-errors'
end
input_container_selector(label = nil, exact: nil) click to toggle source

@param label [String, nil] field label. @param exact [Boolean, nil] match by exact label text (default false). @return [String] selector.

# File lib/capybara/active_admin/selectors/form.rb, line 49
def input_container_selector(label = nil, exact: nil)
  return 'li' if label.nil?

  label_opts = Util.options_with_text(label, exact: exact)
  label_node = find(label_selector, label_opts)
  li_id = label_node.ancestor('li')[:id]
  "li##{li_id}"
end
label_selector() click to toggle source

@return [String] selector.

# File lib/capybara/active_admin/selectors/form.rb, line 18
def label_selector
  'label.label'
end
semantic_error_selector() click to toggle source

@return [String] selector.

# File lib/capybara/active_admin/selectors/form.rb, line 28
def semantic_error_selector
  'ul.errors > li'
end