Module: Capybara::ActiveAdmin::Selectors::Form
- Included in:
- Capybara::ActiveAdmin::Selectors
- Defined in:
- lib/capybara/active_admin/selectors/form.rb
Overview
Selectors for active_admin_form_for and related form components.
Instance Method Summary collapse
-
#filter_form_selector ⇒ String
Selector.
-
#form_selector(model_name = nil) ⇒ String
Selector.
-
#form_submit_selector(text = nil) ⇒ String
Selector.
-
#has_many_fields_selector(association_name) ⇒ String
Selector.
-
#inline_error_selector ⇒ String
Selector.
-
#input_container_selector(label = nil, exact: nil) ⇒ String
Selector.
-
#label_selector ⇒ String
Selector.
-
#semantic_error_selector ⇒ String
Selector.
Instance Method Details
#filter_form_selector ⇒ String
Returns selector.
59 60 61 |
# File 'lib/capybara/active_admin/selectors/form.rb', line 59 def filter_form_selector '.filter_form' end |
#form_selector(model_name = nil) ⇒ String
Returns selector.
10 11 12 13 14 15 |
# 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) ⇒ String
Returns selector.
40 41 42 43 44 |
# 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) ⇒ String
Returns selector.
34 35 36 |
# 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 ⇒ String
Returns selector.
23 24 25 |
# 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) ⇒ String
Returns selector.
49 50 51 52 53 54 55 56 |
# 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.(label, exact: exact) label_node = find(label_selector, label_opts) li_id = label_node.ancestor('li')[:id] "li##{li_id}" end |
#label_selector ⇒ String
Returns selector.
18 19 20 |
# File 'lib/capybara/active_admin/selectors/form.rb', line 18 def label_selector 'label.label' end |
#semantic_error_selector ⇒ String
Returns selector.
28 29 30 |
# File 'lib/capybara/active_admin/selectors/form.rb', line 28 def semantic_error_selector 'ul.errors > li' end |