Sha256: 8272236d840b41e2cebd625c549949c72062f4b70d157955999a7811e0b4c7fd

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

module Capybara
  module ActiveAdmin
    module Actions
      module Table
        def select_table_row(id: nil, index: nil)
          raise ArgumentError, "can't use both :id and :index" if id && index
          raise ArgumentError, 'must provide :id or :index' if id.nil? && index.nil?

          if id
            find("input#batch_action_item_#{id}").click
            return
          end

          selector = %(input[id^="batch_action_item_"])
          find_all(selector, minimum: index + 1)[index].click
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara_active_admin-0.3.3 lib/capybara/active_admin/actions/table.rb