Sha256: 146d2a775561b5e92c4cc2968205e3b1eef0ebc57e150322765b5933dc12d726

Contents?: true

Size: 934 Bytes

Versions: 1

Compression:

Stored size: 934 Bytes

Contents

# frozen_string_literal: true

module Capybara
  module ActiveAdmin
    module Finders
      module Form
        # @param name [Class<Object>, String] form record class or model name
        # @yield within form
        def within_form_for(name)
          name = name.model_name.singular if name.is_a?(Class)
          selector = form_selector(name)
          within(selector) { yield }
        end

        # @param association_name [String]
        # @param index [String] index of fieldset, starts with 0.
        # @yield within fieldset>ol
        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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara_active_admin-0.3.1 lib/capybara/active_admin/finders/form.rb